select * from  表
where
 (datediff(day,时间字段,Getdate())=0 
and fz=0 ) and
(
datediff(day,时间字段,dateadd(day,-1,Getdate()))=0 
and fz!=0
)

解决方案 »

  1.   

    好像不对吧,datediff(day,时间字段,Getdate())=0 和datediff(day,时间字段,dateadd(day,-1,Getdate()))=0 是不可能同时成立的,这样什么情况下都查不到记录吧?!
      

  2.   

    select * from tb a
    where fz = 0
        and datediff(day,时间字段,getdate())=0
        and exists(
            select * from tb where fz<>0 and fid=a.fid and datediff(day,时间字段,getdate())=1)
      

  3.   

    第一次见到钻石!
    另外请问exists的含义是什么,和oracle中哪个函数是一样的?