简体   繁体   中英

Oracle SQL query to delete the all the tuples with duplicates

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

Do you mean something like the following:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM