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

SQL语句求解 时间
select*from biaoA where time between (select CONVERT(varchar(12),getdate(),23)+' 00:00:00.000') and (select CONVERT(varchar(12),getdate(),23)+' 01:00:00.000')
select*from biaoA where time between (select CONVERT(varchar(12),getdate(),23)+' 01:00:00.000') and (select CONVERT(varchar(12),getdate(),23)+' 02:00:00.000')
  .
  .
  .
select*from biaoA where time between (select CONVERT(varchar(12),getdate(),23)+' 23:00:00.000') and (select CONVERT(varchar(12),getdate(),23)+' 24:00:00.000')



表A有个字段为 这样 '2011-12-22 20:20:20.222' 时间 CONVERT(varchar(12),getdate(),121)的
我想把 24小时 的 所有的 SQL语句 写成1条 或者 写出 如果是 系统为1:30 分 那么就查询出 1点到2点的数据 
要根据当前的系统时间 自动跳一段时间内的数据
希望 那个大神帮忙下0 0 跪求ing


------解决方案--------------------
SQL code
select * 
from biaoA 
where time between CONVERT(varchar(13),getdate(),120)+':00:00' and 
DATEADD(hh,1,convert(varchar(13),getdate(),120)+':00:00')