3
我試圖在一週內看到對象的重複記錄。我有興趣看到重複項,而不是隻有一個實例的對象。這是我迄今寫的:顯示SQL查詢的重複記錄
SELECT a.asset, t.ticketnum, t.symptom_mask, t.setsolution, t.`otherdesc`
FROM lamarinfo AS a
JOIN lfso AS t
ON (a.id = t.asset_id)
WHERE open_dt BETWEEN CURDATE() - INTERVAL 7 DAY AND SYSDATE()
GROUP BY a.`asset` HAVING COUNT(*) > 1;
這將返回重複記錄,但不是每個重複記錄。有任何想法嗎?