Re: converting a query with *= into SQL 92
From: David Portas <REMOVE_BEFORE_REPLYING_dportas_at_acm.org>
Date: Wed, 4 Feb 2004 20:35:52 -0000
Message-ID: <mcKdnRAU6uaTyrzdRVn-vA_at_giganews.com>
Date: Wed, 4 Feb 2004 20:35:52 -0000
Message-ID: <mcKdnRAU6uaTyrzdRVn-vA_at_giganews.com>
One of the problems with the SQL89 join syntax is that different RDBMSs may execute the query differently when both inner and outer join predicates are specified. Test the following out to see if it gives the result you expect.
SELECT A.col1, B.col2, C.col2
FROM Tab1 AS A
LEFT JOIN Tab2 AS B
ON A.col1 = B.col1
LEFT JOIN Tab3 AS C
ON A.col2 = C.col2 AND B.col3 = C.col3
> also can we replace *= with =* by interchanging the participating tables
as in
If you specify an inner join as well then this might give different results to your original query. It depends on the order in which the joins are performed. Use LEFT JOIN / RIGHT JOIN / INNER JOIN instead.
-- David Portas SQL Server MVP --Received on Wed Feb 04 2004 - 21:35:52 CET