Title: RE: SQL puzzle - using where (a, b, c) in select (a, b, c from...

Thank you for your answer.
This is not an answer to the problem as stated in the original description. Your statement deleted duplicate rows in widgets_copy even if they were NOT present in widgets.

-----Original Message-----
From: Nirmal Kumar Muthu Kumaran [mailto:[EMAIL PROTECTED]]
Sent: lundi, 18. novembre 2002 22:44
To: Multiple recipients of list ORACLE-L
Subject: RE: SQL puzzle - using where (a, b, c) in select (a, b, c from...


SQL> ed
Wrote file afiedt.buf

  1  select * from widgets_copy
  2* order by 1,2,3
SQL> /

        ID       COST       SELL
---------- ---------- ----------
         1         10         20
         1         10         20
         1         10         30
         1         10         30
         1         10
         1         10
         1
         1

8 rows selected.

SQL> delete widgets_copy where rowid not in (select min(rowid)
  2  from widgets_copy group by id, cost,sell);

4 rows deleted.

SQL> select * from widgets_copy
  2  order by 1,2,3
  3  /

        ID       COST       SELL
---------- ---------- ----------
         1         10         20
         1         10         30
         1         10
         1

SQL>

HTH,
Rgds,
Nirmal.

Reply via email to