Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Query Problem
Ladies and Gents,
I am writing a query in Oracle 7.3 that is giving me a bit of trouble.
I need a single customer code, combined w/ a secondary account number, per group. A group consist of a "region code" and a "rate code".
The problem in this case is the introduction of the secondary account number into the query.
The following query will not work:
Select Unique Region, Rate, Min(Customer), Account
FROM TableA, TableB
Where TableA.Customer = TableB.Customer
Group by Region, Rate, Account;
For this to work the Account would have to be removed from the Group By clause (which obviously will not work) because I need only a single Customer # per Region/Rate.
Any clues?
Any way to randomly select one value per "group" (group excludes the secondary account #)?
I have searced the Oracle 7 Server SQL Reference and do not see any functions like "TOP" or random.
Help! Received on Tue Jan 04 2000 - 09:15:13 CST