select id,WenHao from GW_LZ where datediff(hh,FSTime,getdate())>24
这是我原来的sql语句,但是这个判断是每天都生效的,我现在想查询在工作日内大于24小时的信息,
就是说星期一到星期五的,应该怎么写啊

解决方案 »

  1.   

    select id,WenHao from GW_LZ where datediff(hh,FSTime,getdate())>24 
    and datediff(hh,FSTime,getdate)<=120
      

  2.   

    --1
    select id,WenHao from GW_LZ where datediff(hh,FSTime,getdate())>24 
    where datediff(day,'1900-01-01',FSTime)%7+1 not in(6,7)
    --2
    select id,WenHao from GW_LZ where datediff(hh,FSTime,getdate())>24 
    where (datepart(dw,FSTime))+@@datefirst-1)%7 not in(0,7)
      

  3.   

    好象不对啊,
    select id,WenHao from GW_LZ
     where datediff(day,'1900-01-01',FSTime)%7+1 not in(6,7)
    and datediff(hh,FSTime,getdate())>24 select id,WenHao from GW_LZ where datediff(hh,FSTime,getdate())>24 
    and datediff(hh,FSTime,getdate()) <=120select id,WenHao from GW_LZ where datediff(hh,FSTime,getdate())>24 
    and ((datepart(dw,FSTime))+@@datefirst-1)%7 not in(0,7)
    我的FSTime='2009-1-2 23:52:00'是这个,到现在肯定没超过24小时,今天是周日啊,才过了不到一个小时啊,
    可是,我都能吧这条记录查出来啊