如何将此查询转换为返回TRUE / FALSE值?
SELECT UserID, ResumeID AS PreviouslyViewed FROM MVJ_ProfileViews
WHERE UserID = [User:UserID]
AND ResumeID = [TknParams:ResumeID]
答案 0 :(得分:3)
您可以投射结果
SELECT CASE WHEN EXISTS (
SELECT UserID, ResumeID AS PreviouslyViewed
FROM MVJ_ProfileViews
WHERE UserID = [User:UserID] AND
ResumeID = [TknParams:ResumeID]
)
THEN CAST(1 AS BIT)
ELSE CAST(0 AS BIT)
END AS result
答案 1 :(得分:0)
IF EXISTS ( SELECT UserID, ResumeID AS PreviouslyViewed
FROM MVJ_ProfileViews
WHERE UserID = [User:UserID] AND
ResumeID = [TknParams:ResumeID])
BEGIN
SELECT 'TRUE' Result
END
ELSE
BEGIN
SELECT 'FALSE' Result
END