该查询适用于SQL Server,但在MySQL中不起作用。任何人都可以帮忙吗?在MySQL中选择重复记录
SELECT name
FROM table_name
WHERE
Institution_Code = 1 and
Month= 6 and Year= 2016 and
Id IN (
SELECT Id FROM table_name
where Institution_Code = 1 and
Month= 6 and Year= 2016
GROUP BY Id HAVING count(Id) > 1
)
没有工作,那么整个显示的数据,但我想只是重复数据 – Anup
让我更新我的答案 –
SELECT *,COUNT( '名')is_duplicate FROM'tbl_name' GROUP BY'name' HAVING is_duplicate> 1次的尝试这个 –