SELECT TOP 1000 [ID] ,[SourcePageID] ,[PlatformType] ,[CreateTime] FROM [home_sendorder].[dbo].[ApplyUser]where [PlatformType]=2 and [CreateTime]>='2015-10-28' and [CreateTime]<='2015-11-1'注意这样写,只是从28号0点查到1号0点 -----------------------
原文链接:https://blog.csdn.net/dobear_0922/article/details/2393235 --1.删除测试用表IF OBJECT_ID(N'Test', N'U') IS NOT NULL DROP TABLE Test --2.建立测试表,并填充测试数据SELECT * INTO Test FROM( SELECT CONVERT(DATETIME, '2008-1-1', 120) AS dt UNION ALL SELECT '2008-1-
1.确定两个日期之间的工作日天数 --确定两个日期之间的工作日天数with x0 as (select to_date('2018-01-01','yyyy-mm-dd') as 日期 from dual union all select to_date('2018-01-15','yyyy-mm-dd') as 日期 from dual ), x1 as --日期并列显示 (select min (日期) 开始日期,max(日期) 结束日期 from x0 ), x2 as --日期之间的天数
使用sql语句查询日期在一周内的数据 select * from ShopOrder where datediff(week,ordTime,getdate()-1)=0 //查询当天日期在一周年的数据 select * from ShopOrder where datediff(day,ordTime,getdate()-1)=0 //查询当天的所有数据 SELECT * FROM A where datediff(d,datetime,getdate()) <=30 //前30天 S