Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Identifying duplicate rows and querying results
Hi all,
I'm trying to develop the PL/SQL code that can list only rows that have a repeating cust_code, then out of the results list rows that have the same cust_code but different cust_id. For example:
CUST_CODE CUST_ID AGENCY
12 103 NAV 12 103 NAV 13 108 NAV 14 111 MAR 15 114 AIR 16 123 AIR 16 117 AIR 16 192 ARM 16 192 AIR 18 160 MAR 19 159 ARM 20 112 NAV 21 181 MAR 22 172 MAR 23 182 MAR 24 104 ARM 24 104 ARM 24 198 ARM 24 155 ARM 25 133 NAV 25 192 AIR 26 140 NAV 27 165 AIR 27 165 AIR
I know that CUST_CODEs' 12, 16, 24, 25, 27 all have duplicates, but I'm trying to produce only the rows that also have a different CUST_ID.
The desired output should look like this:
CUST_CODE CUST_ID AGENCY
16 123 AIR 16 117 AIR 24 198 ARM 24 155 ARM 25 133 NAV 25 192 AIR
Any help would be appreciated.
Ronald
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Wed Feb 09 2000 - 11:05:52 CST