有关时间的查询

1.最近7天:datediff(DAY,lepu_ImplantedDate,getdate()) <7

2.最近一个月:datediff(day,datefield,getdate()) <=30

3.获取第一条数据:select top(1) DomainName from SystemUser,select top(1) * from SystemUser

4.分组并排序:select  * from SystemUser group by BusinessUnitIdName order by lepu_Age desc

 

posted @ 2012-09-11 09:17  717806198  阅读(137)  评论(0编辑  收藏  举报