如何写出一个SQL语句 ,查询出数据库的重复记录行
2个回答
展开全部
看下面这个例子,可以应该可以帮你实现:
表KILO
ID CREDIT
100 100
100 100
101 122
101 122
111 222
113 223
CREATE TABLE KILO (ID INT ,CREDIT INT)
INSERT INTO KILO VALUES(100,100)
INSERT INTO KILO VALUES(100,100)
INSERT INTO KILO VALUES(101,122)
INSERT INTO KILO VALUES(101,122)
INSERT INTO KILO VALUES(111,222)
INSERT INTO KILO VALUES(113,223)
SQL实现查询出重复记录行:
SELECT * FROM KILO WHERE ID IN (SELECT ID FROM KILO
GROUP BY ID
HAVING COUNT(ID)<2)
表KILO
ID CREDIT
100 100
100 100
101 122
101 122
111 222
113 223
CREATE TABLE KILO (ID INT ,CREDIT INT)
INSERT INTO KILO VALUES(100,100)
INSERT INTO KILO VALUES(100,100)
INSERT INTO KILO VALUES(101,122)
INSERT INTO KILO VALUES(101,122)
INSERT INTO KILO VALUES(111,222)
INSERT INTO KILO VALUES(113,223)
SQL实现查询出重复记录行:
SELECT * FROM KILO WHERE ID IN (SELECT ID FROM KILO
GROUP BY ID
HAVING COUNT(ID)<2)
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询