周大胖子 发表于 2022-4-22 15:54:22

同一表里搜同一列数据重复的数据

SELECT * FROM xlist95 WHERE 'xtype' IN(SELECT 'xtype' FROM xlist95 GROUP BY 'xtype' HAVING COUNT('xtype')>1);

select 'xtype',count(1) as counts from xlist95 group by 'xtype' having count(*)>1;


SELECT * FROM xlist95 t WHERE xtype IN (SELECT xtype FROM xlist95 GROUP BY xtype HAVING COUNT(xtype )>1 ) ORDER BY t.xtype;


SELECT * FROM xlist95 t WHERE xtype IN (SELECT xtype FROM xlist95 GROUP BY xtype HAVING COUNT(xtype )>1 ) ORDER BY t.xtype; 行之有效 但是未判断出空 xtype ;


SELECT * FROM xlist95 t WHERE xtype IN (SELECT xtype FROM xlist95 GROUP BY xtype HAVING COUNT(xtype )>1 ) ORDER BY t.xtypeand xtype is not null;[失败]


SELECT * FROM xlist95 t WHERE xtype IN (SELECT xtype FROM xlist95 GROUP BY xtype HAVING COUNT(xtype )>1 and xtype IS NOT NULL ) ORDER BY t.xtype and xtype IS NOT NULL;[失败]

SELECT 'xtype',count(1) as counts FROM xlist95 t WHERE xtype IN (SELECT xtype FROM xlist95 GROUP BY xtype HAVING COUNT(xtype )>1 ) ORDER BY t.xtypeand xtype is not null;[失败]

SELECT 'xtype',count(1) as counts FROM xlist95 t WHERE xtype IN (SELECT xtype FROM xlist95 GROUP BY xtype HAVING COUNT(xtype )>1 ) ORDER BY t.xtype ;[失败]

SELECT 'xtype',count(*) as counts FROM xlist95 t WHERE xtype IN (SELECT xtype FROM xlist95 GROUP BY xtype HAVING COUNT(xtype )>1 ) ORDER BY t.xtypeand xtype is not null;[失败]
页: [1]
查看完整版本: 同一表里搜同一列数据重复的数据