我相信你需要得到正確的case-when
刪除B.。這是正確的case-when
:
case when A.RegisteredProduct1 = 'Yes' then 'Yes' else B.RegisteredProduct1 end
這是你所需要的查詢:
SELECT A.EmailAddress,
case when A.RegisteredProduct1 = 'Yes' then 'Yes' else B.RegisteredProduct1 end
FROM WebinarMasterDE B
Join WebResponseDe A ON A.EmailAddress = B.EmailAddress
然而,最簡單的語法層面的解決辦法是增加一個缺少的逗號:
SELECT A.EmailAddress,
case when A.RegisteredProduct1 = 'Yes' then 'Yes'
end, -- this is it, the missing comma
B.RegisteredProduct1 -- this is a new column
FROM WebinarMasterDE B
Join WebResponseDe A ON A.EmailAddress = B.EmailAddress