該查詢適用於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次的嘗試這個 –