I need to Capture WHERE Clause Conditional Result and append in SELECT Statement using SQL Server
Sample SQL:
SELECT c.*
, Result_Of_Condition_#1
, Result_Of_Condition_#2
FROM Customer c
WHERE (Condition #1) OR (Condition #2)
Note: Kindly avoid replicating the SAME Condition once again in the SELECT Query. I need a smart approach.
Don't share the following approach
SELECT c.*
, CASE WHEN (Condition #1) THEN 1 ELSE 0 END
, CASE WHEN (Condition #2) THEN 1 ELSE 0 END
FROM Customer c
WHERE (Condition #1) OR (Condition #2)
Kindly assist me.