简单SQL语法问题(急)
想找出表中的关键字(2个字段)的重复记录,语句为:
SELECT * FROM biao a WHERE (a.dd,a.lj)IN (SELECT dd,lj FROM biao GROUP BY dd,lj HAVING COUNT(*)>1)
运行提示第一行','附近有语法错误,SQL新手表示没法了。 多字段?关键字?重复
[解决办法]
SELECT dd,lj FROM biao GROUP BY dd,lj HAVING COUNT(*)>1
SELECT * FROM biao a
WHERE exists(SELECT 1 FROM biao
where a.dd=dd and a.lj=lj
GROUP BY dd,lj HAVING COUNT(*)>1)
SELECT * FROM biao a WHERE id in (SELECT max(id) FROM biao GROUP BY dd,lj HAVING COUNT(*)>1 )