SQL获取当天注册数据的2种写法

--获取当天注册数据的2种写法,当然更推荐第二种
--第一种
select RegisterDate from [QPAccountsDB].[dbo].[AccountsInfo] where CONVERT(varchar(10),RegisterDate,120)=CONVERT(varchar(10),GETDATE(),120)
--第二种
select RegisterDate,datediff(dd,RegisterDate,getdate()) from [QPAccountsDB].[dbo].[AccountsInfo] where datediff(dd,RegisterDate,getdate())=0

posted @ 2016-06-03 17:06  唔愛吃蘋果  阅读(261)  评论(0编辑  收藏  举报