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

做个判断,忘高手指点!
做个if判断,条件是      
select   sdate   from   songinfo   where   datediff(dd,sdate,getdate())> 0  
如果条件成立,它执行“update   songinfo   set   dayhit=1”;
不成立的话,执行select   *   from   songinfo   ;
SQL语句怎么写???


------解决方案--------------------
if exists (select sdate from songinfo where datediff(dd,sdate,getdate())> 0)
update songinfo set dayhit=1

else
select * from songinfo