Sql 在字符串中使用case语句
我需要把一个case语句放在一个字符串中。如何做到这一点Sql 在字符串中使用case语句,sql,sql-server,Sql,Sql Server,我需要把一个case语句放在一个字符串中。如何做到这一点 select DATEDIFF(MM, select CASE FA.new_ownertype WHEN 8 then FA.new_vlenrollmentstartdate ELSE FA.new_contractstartdate from BingMapsPlatform_Stagging.dbo.FilteredAccount as FA END, GETDATE()) sel
select DATEDIFF(MM, select CASE FA.new_ownertype
WHEN 8 then FA.new_vlenrollmentstartdate
ELSE FA.new_contractstartdate from BingMapsPlatform_Stagging.dbo.FilteredAccount as FA
END, GETDATE())
select DATEDIFF(MM,
CASE FA.new_ownertype
WHEN 8 then FA.new_vlenrollmentstartdate
ELSE FA.new_contractstartdate
END, GETDATE())
from BingMapsPlatform_Stagging.dbo.FilteredAccount as FA