SELECT
CASE
WHEN EXISTS(
SELECT 1 FROM call_records
WHERE account = @accountnumber
)
THEN 'We Have Records of this Customer'
ELSE 'We Do Not Have Records For This Customer'
END AS 'result';
第二种方法:
IF EXISTS(SELECT SolderStatus FROM SolderInfo WHERE SolderNo='{0}') SELECT SolderStatus FROM SolderInfo WHERE SolderNo='{1}' ELSE SELECT 999 AS SolderStatus