mysql删除重复语句问题
以前用sql server 现在改用mysql数据库,发现同一句语句在sql server里能使用,到了mysql里就报这种错误了[Err] 1093 - You can't specify target table 'KSOthers' for update in FROM clause
sql server 语句如下
DELETE FROM KSOthers
WHERE (id NOT IN
(SELECT MIN(id) AS Expr1
FROM KSOthers AS KS_1
GROUP BY Kid)) or (Kvicinity not like '%昆山市%')
哪位大侠能帮我改成mysql里面的删除重复语句啊
------解决方案--------------------delete from KSOthers where kid in
(select kid from KSOthers group by kid having count(kid) > 1)
------解决方案--------------------先查 看能不能查到你要的结果
------解决方案--------------------4、删除表中多余的重复记录(多个字段),只留有rowid最小的记录
delete from vitae a
where (a.peopleId,a.seq) in (select peopleId,seq from vitae group by peopleId,seq having count(*) > 1)
and rowid not in (select min(rowid) from vitae group by peopleId,seq having count(*)>1)
http://unix-cd.com/vc/www/26/2007-07/6099.html