表user(userid,username,age,sex)中有完全重复数据,分别写出Sql server与Oracle去重语句?
2个回答
2012-05-30 · 知道合伙人互联网行家
关注
展开全部
sql server 去重语句:
delete from user where userid in (select max(userid) from user group by userid)
delete from user where userid in (select max(userid) from user group by userid)
追问
知道oracle怎么写的嘛 谢谢
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
oracle 中:
DELETE FROM EMP E WHERE E.ROWID > (SELECT MIN(X.ROWID)
FROM EMP X WHERE X.EMP_NO = E.EMP_NO);
DELETE FROM EMP E WHERE E.ROWID > (SELECT MIN(X.ROWID)
FROM EMP X WHERE X.EMP_NO = E.EMP_NO);
追问
你好,你能根据题目的字段重新写一次吗?不是很明白 谢谢
追答
DELETE FROM user a WHERE a.ROWID > (SELECT MIN(b.ROWID)
FROM user b WHERE a.userid=b.userid);
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询