如何使用IF EXISTS语句从子查询中选择布尔值(SQL Server)?
代码应该类似于:
SELECT
TABLE1.Id,
NewFiled = (IF EXISTS(SELECT Id FROM TABLE2 WHERE TABLE2.ID = TABLE1.ID)
SELECT 'TRUE'
ELSE
SELECT 'FALSE')
FROM TABLE1