MySQL Forums
Forum List  »  Microsoft SQL Server

Complex Outer Join Problem - all suggestiions appreciated
Posted by: Zoran Avtarovski
Date: March 04, 2006 10:14PM

I am using the following query and I'm not getting expected results:

SELECT *
FROM users as U, domain as D
LEFT OUTER JOIN
( user_hospitals as UH JOIN hospital as H on H.hospital_id = UH.hospital_id)
on U.user_id = UH.user_id
WHERE U.domain_id = D.domain_id

when the user_hospitals table is empty the query returns no data, but it should return everything in the users table and nulls for the other fields. That is how it works in SQL Server and SyBase.

If I change it to:
SELECT *
FROM users as U, domain as D
LEFT OUTER JOIN user_hospitals on U.user_id = UH.user_id
WHERE U.domain_id = D.domain_id

It works as expected. What am I missing. Does MySQL support this and if not what's the work around.

Zoran

Options: ReplyQuote


Subject
Written By
Posted
Complex Outer Join Problem - all suggestiions appreciated
March 04, 2006 10:14PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.