select case when (count(*) > 0) then cast('false' as bit) else cast('true' as bit) end
from infu_detail id
where id.drug_status in ('P', 'I', 'S', 'C', 'F')
and id.group_master_id = '36'
select cast(case when (count(*) > 0) then 'false' else 'true' end as bit) as canSplit
from infu_detail id
where id.drug_status in ('P', 'I', 'S', 'C', 'F')
and id.group_master_id = '37'
select getdate()
select suser_name()
select user_name()
reference:
[url]http://stackoverflow.com/questions/63447/how-do-you-perform-an-if-then-in-an-sql-select[/url]
[url]http://msdn.microsoft.com/zh-cn/library/ms177603.aspx[/url]