I have two files and I'd like to join and make a group-by on a xycod, in order to count the number of occurrences. This is the question: What happens on the RRN filed when i try to do group by statement? There is one-to-many relation between records and RRNs, so which is the RRN assigned to it?
Software/Hardware used:
ASKED:
October 13, 2008 1:27 PM
UPDATED:
August 22, 2010 10:05 PM
yes, i’m doing a SQL join…and ok, the role of RRN is not relevant to obtain the result of statement.
it’s a conceptual curiosity only…
infact there are many “one-to-many” relation between records and RRNs, and i’d like to know which is the RRN assigned…
for example max(RRN(<file>))
…
Well, I think they have created a temp file so the RRN’s of that file would have no relationship to either parent file.
for example max(RRN(<file>))
For that example, it would be the highest record number in <file>.
For GROUP BY operations, you can’t reasonably retrieve RRN() in the SELECT list because it’s a scalar function. Only aggregate functions may be used in a GROUP BY result set field list, e.g., SUM() and MAX() or MIN(). To use it on by itself, it would also need to be specified in the GROUP BY clause which would make the GROUP BY clause meaningless since each RRN() value will be unique.
Tom