SQL 92 answer.
Re: Selecting Duplicate Entries in a table?
Simon,
What about :
[sql]
SELECT torder_no,tpart_no, Qty FROM orders GROUP BY torder_no,tpart_no HAVING count(*)>1;
[/sql]
You could also try:
[sql]
SELECT t1.torder_no, t1.tpart_no, t1.Qty FROM orders as t1, orders as t2 WHERE t1.order_no = t2.order_no AND t1.id <> t2.id
[/sql]
I am assuming that you also have a primary key (id) in the orders table.
Once you delete all the duplicates you may want to put a unique constraint on the order_no column to avoid duplicates in future.
|