|
Posted by Gert-Jan Strik on 02/15/07 22:12
It's quite simple... once you've seen it!
SELECT CASE WHEN ManagerReport.PIN IS NULL THEN 'TRUE'
ELSE 'FALSE' END AS IsRerun
FROM ...
HTH,
Gert-Jan
Radu wrote:
>
> Hi. I'm trying to build a query which would return TRUE or FALSE as
> 'IsRerun' depending on the matching status with another table, as
> follows (simplified query):
>
> SELECT ImportedPINS.PIN,
> CASE ManagerReport.PIN
> WHEN (IS NULL)
> THEN 'FALSE'
> ELSE
> 'TRUE'
> END AS IsRerun,
> FROM
> ImportedPINS LEFT OUTER JOIN ManagerReport
> ON ImportedPINS.PIN = ManagerReport.PIN
>
> This version returns "Incorrect syntax near the keyword 'IS'"
>
> I have tried a lot of versions..... like
> CASE ManagerReport.PIN
> WHEN ManagerReport.PIN IS NULL
> THEN 'TRUE'
> ELSE
> 'FALSE'
> END AS IsRerun
>
> or
>
> CASE ManagerReport.PIN
> WHEN IS NULL
> THEN 'TRUE'
> ELSE
> 'FALSE'
> END AS IsRerun
>
> or
>
> CASE ManagerReport.PIN
> WHEN NULL
> THEN 'TRUE'
> ELSE
> 'FALSE'
> END AS IsRerun
>
> (this one executes, but ALL show as TRUE, and my data says that out of
> 200 test records I should have 195 Reruns and 5 Not Reruns)
>
> Please, how should I write this ?
> Thanks a lot
> Alex.
Navigation:
[Reply to this message]
|