发布网友
共4个回答
热心网友
oracle的写法:
select * from your_table a
where your_date_field between to_date(to_char(sysdate,'YYYYMMDD')||'00 00 00','YYYYMMDD HH24:MI:SS') and sysdate
热心网友
SQL时间段查询
ACCESS的话
select * from table where date1<#2008-1-20# and date2>#2007-8-30#
MYSQL的话
select * from table where date1<'2008-1-20' and date2>'2007-3-30'
也可以
select * from table where date1 between '2008-1-20' and '2007-3-30'
其中date1,date2都是日期类型的字段
热心网友
where time between convert(datetime,convert(varchar(10),getdate())) and getdate()
热心网友
--这个查询结果为 2010-09-17 00:00:00.000
SELECT CAST(SUBSTRING(CONVERT(Nvarchar, GETDATE(), 120), 1, 10) AS DATETIME) AS A
--这个查询结果为 2010-09-18 00:00:00.000
SELECT DATEADD(DAY, 1, CAST(SUBSTRING(CONVERT(varchar, GETDATE(), 120), 1, 10) AS DATETIME)) AS B
--这个查询结果为 2010-09-17 22:40:17.903
SELECT GETDATE() AS C
SELECT * FROM TABLE WHERE FILED >= A AND FILED <= C
你的明白?