Kings Kings - 2 months ago 6
SQL Question

Use of 1=2 in a SQL query

Someone please explain the meaning of '1=2' in the below SQL query.

SELECT E.EmpID,
E.EmpName,
Country = CASE
WHEN T.Active = 'N'
AND 1 = 2 THEN 'Not Working Anymore'
ELSE C.Country_Name
END,
T.Contract_No
FROM Employees E (nolock)
INNER JOIN Contract T
ON T.Contract_No = E.Contract_No
LEFT JOIN Country C (nolock)
ON E.Country_ID = C.Country_ID


thanks

EDIT:- Corrected the slight mistake existed in the example SQL query given by me.
@ ALL :- The query mentioned here is an example version of a big working query on which I have to reoslve something. I have created a sample scenario of SQL query for the sake of simplicity of question.

Answer
when T.Active = 'N' and 1=2 then 'Not Working Anymore' 

Simple, the above condition will never become true. So the result will always be C.Country_Name