Using 1 = 2 in an SQL query

Someone please explain the meaning of '1 = 2' in the following 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 

thank

EDIT: - Fixed a small bug existing in the SQL example provided by me. @ALL: - The request mentioned here is an example version of a large working request, on which I need to redo something. I created a sample SQL query script to simplify the question.

+5
source share
8 answers
when T.Active = 'N' and 1=2 then 'Not Working Anymore' 

The simple, above condition will never become true. Thus, the result will always beC.Country_Name

+5
source

1=2 WHERE, , . :

CREATE TABLE ABC_TEMP AS
    SELECT * FROM ABC WHERE 1=2;
+13

, SQL-. "T.Active =" N "" , , "1 = 2" .

Update: 1 = 1 1 = 2, , . , , .

2 , , AND, .

+5

FALSE.

:

select * from TABLE where 1=2

.

+3

WHERE 1=2, ,

1=2 false.

+1

1 = 2 , false. , , , .

, , , .

+1

, script. . , .

+1

1 = 2 , , ; ( "NULL" ) ...

..      empt_tgt           empno, ename, job, mgr, sal      1 = 2;

, empt_tgt :    SELECT * FROM empt_tgt

EMPT_TGT null; empno, ename, job, mgr, sal no data...

+1

All Articles