sql 时间范围查询条件

--一年内注册查询

select * from User where datediff(year,Createdate,getdate())=0


--一月内注册查询

select * from User where datediff(month,Createdate,getdate())=0


--一天内注册查询

select * from User where datediff(day,Createdate,getdate())=0


你可能感兴趣的:(SQL)