当前位置: 代码迷 >> Sql Server >> 做个判断,忘
  详细解决方案

做个判断,忘

热度:99   发布时间:2016-04-27 16:05:57.0
做个判断,忘高手指点!
做个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
  相关解决方案