日期:2014-05-18  浏览次数:20420 次

有开始时间 要48小时内的数据 求SQL语句
有开始时间 要48小时内的数据 求SQL语句

------解决方案--------------------
SQL code
select * from tb where datediff(hh,开始时间,时间字段)<=24

------解决方案--------------------
SQL code
select * from tb where datediff(hh,时间字段,'开始时间') between 0 and 47

------解决方案--------------------
探讨

SQL code
select * from tb where datediff(hh,开始时间,时间字段)<=24

------解决方案--------------------
select * from tb where datediff(hh,开始时间,时间字段)<=48
------解决方案--------------------
探讨
引用:

SQL code
select * from tb where datediff(hh,开始时间,时间字段)<=24



SQL code

select * from tb where datediff(HOUR,开始时间,时间字段)<=48

------解决方案--------------------
探讨
开始时间是
DISCHARGE_DATE_TIME
2010-04-11 14:00:00.000
2010-03-13 08:36:00.000
2010-03-17 09:55:00.000
2010-04-30 10:56:00.000
2010-04-10 13:28:00.000
2010-04-27 14:00:00.000

select * from tb w……

------解决方案--------------------
SQL code
select * from tb where DISCHARGE_DATE_TIME>=dateadd(HOUR,48,DISCHARGE_DATE_TIME)