sql语句if。。。else使用和exists使用

来源:互联网 发布:dsm数据是什么 编辑:程序博客网 时间:2024/06/14 13:41

if exists
(

  select date from MonthStatisticOne where date = '2015-01-01 00:00:00'
 
)select 1 as a

else
 select 0 as a

 

 表MonthStatisticOne 中有满足条件的date的值 则标记a为1 否则为0

0 0
原创粉丝点击