0

我需要将 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())
4

1 回答 1

4
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
于 2013-05-02T11:14:15.340 回答