sql:删除重复记录,1093 - Table 'student' is specified twice...
答案:1 悬赏:0 手机版
解决时间 2021-02-11 20:59
- 提问者网友:战皆罪
- 2021-02-11 13:10
sql:删除重复记录,1093 - Table 'student' is specified twice...
最佳答案
- 五星知识达人网友:拾荒鲤
- 2021-02-11 13:56
试试这个-------------------------------
DELETe from student
WHERe number IN(SELECt number FROM student GROUP BY number HAVINg COUNT(number)>1)
AND score NOT IN(SELECt MAX(score) from student GROUP BY number HAVINg COUNT(*)>1)追问结果一样的还是不行,是不是表数据不对,数据是这样的
追答下面这句看能不能执行--------------------
要是可以,那就不能对同一张表同时进行查询和删除操作
select * from student
WHERe number IN(SELECt number FROM student GROUP BY number HAVINg COUNT(number)>1)
AND score NOT IN(SELECt MAX(score) from student GROUP BY number HAVINg COUNT(*)>1)
DELETe from student
WHERe number IN(SELECt number FROM student GROUP BY number HAVINg COUNT(number)>1)
AND score NOT IN(SELECt MAX(score) from student GROUP BY number HAVINg COUNT(*)>1)追问结果一样的还是不行,是不是表数据不对,数据是这样的
追答下面这句看能不能执行--------------------
要是可以,那就不能对同一张表同时进行查询和删除操作
select * from student
WHERe number IN(SELECt number FROM student GROUP BY number HAVINg COUNT(number)>1)
AND score NOT IN(SELECt MAX(score) from student GROUP BY number HAVINg COUNT(*)>1)
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯