I would like to delete duplicate records from student table. I am using MySQL server version 5.7
create table student (
sid int not null,
sname varchar(50) not null,
city varchar(50) not null
) ;
Delete duplicate records using self join is working fine
delete t1 from student as t1
inner join student as t2
on t1.sid < t2.sid and t1.sname = t2.sname;
Delete duplicate records using sub query is not working
delete s1 from student
where sid > (select sid from (select min(sid) from student s2
where s2.sname = sname) as t);
I tried instruction mentioned in the below link also
Delete duplicate rows using Sub-query
It is not working.