0

Given the table Seminar (SeminarNo,title,location),my SQL query is an attempt to delete the all the tuples with duplicate seminar ids, but im not sure where to go from here.it does not work.

   Delete from Seminar S
   where (
   Select * from Seminar 
   Group by seminarno
   Having count (seminarno)> 1 );

Any suggestions would be helpful

  • The title says Oracle but the tag says MySQL. Which database are you actually using? – GMB May 07 '20 at 16:58
  • If all 3 columns of the table are duplicated you cannot achieve it using a single delete statement.Could you check the solution https://stackoverflow.com/questions/2728413/equivalent-of-oracle-s-rowid-in-mysql. – VN'sCorner May 07 '20 at 17:01
  • Tag your question properly!!! If this is Oracle, why is the question tagged MySQL??? They're 2 completely different products. – Eric May 07 '20 at 17:07

1 Answers1

0

Do you mean something like the following:

delete from Seminar
 where seminarno in (select seminarno
                       from Seminar
                      group by seminarno
                     having count(*) > 1)

Abra
  • 19,142
  • 7
  • 29
  • 41