I have a table named Table1
with two integer fields:
ID1 ID2
1 NULL
2 NULL
3 1
I have a view of this table named ViewOfTable1
:
SELECT ID1, ID2, 'Ok' AS Flag
FROM Table1
WHERE ID2 IS NOT NULL
I run the following query:
SELECT Table1.ID, ViewOfTable1.Flag
FROM Table1
LEFT OUTER JOIN ViewOfTable1 ON Table1.ID = ViewOfTable1.ID2
I expect the result to be :
ID Flag
1 Ok
2 NULL
3 NULL
And this is what I get on my machine with SQL Server Desktop Edition installed, but when I run this query in another machine with SQL Server 2000 Enterprise Edition SP4 I get:
ID Flag
1 Ok
2 OK
3 OK
What could be the problem?