Home » SQL & PL/SQL » SQL & PL/SQL » duplicates
duplicates [message #1928] Tue, 11 June 2002 11:13 Go to next message
Siva KV
Messages: 1
Registered: June 2002
Junior Member
I have a table t1 which has some of the following columns: cost, sess, rcv, po, prd, store and date_time. I need to get all those PO that have been duplicated. The way to look at them would be to find out all those that have a different sess and date_time for the same PO, cost, rcv, prd and store.

Example
cost sess rcv po prd store date_time
10 100 1000 2 23 4 05/06/02 10:50:04 AM
20 100 1000 2 24 4 05/06/02 10:50:04 AM
23 101 1002 3 12 4 05/06/02 10;50:04 AM
23 111 1002 3 12 4 05/06/02 10:50:04 AM
24 102 1003 4 16 3 05/06/02 10:50:04 AM
24 112 1003 4 16 3 05/06/02 1:12:12 PM

My self join is retrieving is retrieving both PO 3 and 4.

TIA,
regards,
Siva
Re: duplicates [message #1930 is a reply to message #1928] Tue, 11 June 2002 21:57 Go to previous message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
typically, you'd do something like:

select a.*
from your_table a
, your_table b
where a.po = b.po
and a.cost = b.cost
and a.rcv = b.rcv
and a.prd = b.prd
and a.store = b.store
and a.sess != b.sess
and a.date_time > b.date_time

Shouldn't be a problem.

MHE
Previous Topic: Un committed Transactions
Next Topic: problem in SQL
Goto Forum:
  


Current Time: Mon May 20 14:33:47 CDT 2024