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

sql 查询的语句
SQL code

(case
when  (select dailijihui from  House_kuozhan   where  House_kuozhan.fid = House_into.id)=1   
       and   datediff(d,getdate(),convert(nvarchar(10),dateadd(d,-30,tuizuDate),20))<=0  
 then   '<span  style=\"color:blue;\"></span>'    

when  (select dailijihui from  House_kuozhan   where  House_kuozhan.fid = House_into.id)=1   
       and  datediff(d,getdate(),convert(nvarchar(10),dateadd(d,-30,tuizuDate),20))>0   
 then   '<span  style=\"color:blue;text-decoration:line-through;\"></span>'    

when    datediff(d,getdate(),convert(nvarchar(10),dateadd(d,-30,tuizuDate),20))<=0      and    
(     
(select datediff(d,fuwushijian,getdate())  from  House_kuozhan   where  House_kuozhan.fid = House_into.id) > 7    
        and   (select dailijihui from  House_kuozhan   where  House_kuozhan.fid = House_into.id)=0     
or    
(select datediff(d,fuwushijian,getdate())  from  House_kuozhan   where  House_kuozhan.fid = House_into.id) > 90   
         and   (select dailijihui from  House_kuozhan   where  House_kuozhan.fid = House_into.id) in(0.1,0.2,0.3)    
or    
(select datediff(d,fuwushijian,getdate())  from  House_kuozhan   where  House_kuozhan.fid = House_into.id) > 60    
          and   (select dailijihui from  House_kuozhan   where  House_kuozhan.fid = House_into.id) in(0.4,0.5,0.6)    
or    
(select datediff(d,fuwushijian,getdate())  from  House_kuozhan   where  House_kuozhan.fid = House_into.id) > 30    
         and   (select dailijihui from  House_kuozhan   where  House_kuozhan.fid = House_into.id) in(0.7,0.8,0.9)    
)   
then  '<span  style=\"color:red;\"></span>' 

   when    datediff(d,getdate(),convert(nvarchar(10),dateadd(d,-30,tuizuDate),20))<=0      and    
    (     
   (select datediff(d,fuwushijian,getdate())  from  House_kuozhan   where  House_kuozhan.fid = House_into.id) >= 4    
            and   (select datediff(d,fuwushijian,getdate())  from  House_kuozhan   where  House_kuozhan.fid = House_into.id) < 7    
            and   (select dailijihui from  House_kuozhan   where  House_kuozhan.fid = House_into.id)=0     
    or    
   (select datediff(d,fuwushijian,getdate())  from  House_kuozhan   where  House_kuozhan.fid = House_into.id) >= 87   
            and   (select datediff(d,fuwushijian,getdate())  from  House_kuozhan   where  House_kuozhan.fid = House_into.id) < 90    
             and   (select dailijihui from  House_kuozhan   where  House_kuozhan.fid = House_into.id) in(0.1,0.2,0.3)    
    or    
   (select datediff(d,fuwushijian,getdate())  from  House_kuozhan   where  House_kuozhan.fid = House_into.id) >= 57    
            and   (select datediff(d,fuwushijian,getdate())  from  House_kuozhan   where  House_kuozhan.fid = House_into.id) < 60    
              and   (select dailijihui from  House_kuozhan   where  House_kuozhan.fid = House_into.id) in(0.4,0.5,0.6)    
    or    
   (select datediff(d,fuwushijian,getdate())  from  House_kuozhan   where  House_kuozhan.fid = House_into.id) >= 27    
            and   (select datediff(d,fuwushijian,getdate())  from  House_kuozhan   where  House_kuozhan.fid = House_into.id) < 30    
             and   (select dailijihui from  House_kuozhan   where  House_kuozhan.fid = House_into.id) in(0.7,0.8,0.9)    
   )   

 then  '<span  style=\"color:#8b0000;\"></span>' 

when    datediff(d,getdate(),convert(nvarchar(10),dateadd(d,-30,tuizuDate),20))>0      and    
(     
(select datediff(d,fuwushijian,getdate())  from  House_kuozhan   where  House_kuozhan.fid = House_into.id) > 7    
        and   (select dailijihui from  House_kuozhan   where  House_kuozhan.fid = House_into.id)=0     
or    
(select datediff(d,fuwushijian,getdate())  from  House_kuozhan   where  House_kuozh