SQL2008-删除时间字段重复的方法

ID  EMAgitation_ID    YieldDateTime

1   2                              2012-02-11 10:18:54.000
2   2                              2012-02-11 10:18:54.000
3   2                              2012-02-11 11:28:12.000
4   2                              2012-02-11 11:28:12.000

 

Delete From StuffAgitationYield Where ID in (select MIN(ID) From StuffAgitationYield Group By YieldDateTime,EMAgitation_ID  Having Count(YieldDateTime)>1 and YieldDateTime>='2012-02-01 00:00:00.000' and YieldDateTime<='2012-02-29 00:00:00.000')

 

ID  EMAgitation_ID    YieldDateTime

2   2                              2012-02-11 10:18:54.000
4   2                              2012-02-11 11:28:12.000

posted on 2015-07-12 10:13  疯狂delphi  阅读(313)  评论(0编辑  收藏  举报

导航