ASP.NET:用于删除重复记录的SQL语句
问题描述:
我可以用来删除重复记录的任何SQL语句吗?
我试过DISTINCT但它没有帮助
这是我的sql语句:
Any SQL statement that I can use to remove duplicated records ?
I tried DISTINCT but its not helping
Here is my sql statement :
SELECT DISTINCT
Status_Legend.Status_Legend_ID, Status_Legend.Status_Legend_Desc, Status_Legend.Status_Legend_Severity, Station_Status_History.Status_Time
FROM Status_Legend CROSS JOIN
Station_Status_History
WHERE (Status_Legend.Status_Legend_Desc = @Status_Legend_Desc)
ORDER BY Status_Legend.Status_Legend_ID
结果:
Result :
1 good 7 2013-06-24 03:22:58 PM
1 good 7 2013-07-21 01:40:14 PM
1 good 7 2013-07-25 09:20:20 AM
1 good 7 2013-08-09 03:03:44 AM
1 good 7 2013-07-04 09:26:21 PM
1 good 7 2013-07-26 09:00:16 PM
1 good 7 2013-08-08 08:07:13 AM
1 good 7 2013-07-17 06:00:15 AM
1 good 7 2013-07-21 08:20:17 AM
1 good 7 2013-07-26 01:20:16 AM
1 good 7 2013-07-27 03:20:20 AM
1 good 7 2013-07-31 10:00:25 AM
预期结果:
1 good 7 2013-07-27 03:20:20 AM
只有一个记录
感谢你的帮助!
Expected Result :
1 good 7 2013-07-27 03:20:20 AM
Only one RECORD
Thanks for your help in advance!