Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Query Problem

Query Problem

From: Rick Moore <rlmoore_at_purdue.edu>
Date: Tue, 4 Jan 2000 10:15:13 -0500
Message-ID: <Pine.SOL.4.10.10001040959290.10846-100000@herald.cc.purdue.edu>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US