[thelist] mySQL question
Andy Budd
andy at message.uk.com
Wed Feb 11 07:34:21 CST 2004
kaoskoder at pandora.be wrote:
> hi,
> no sql expert here, but i think this should work
>
> SELECT un.user_id, un.name, up.phone, um.mobile
> FROM user_name un, user_phone up, user_mobile um
> WHERE un.user_id = up.user_id
> and un.user_id = um.user_id
Thanks for the response. However that would only bring back records
that had a direct match in the right hand tables.
However I've actually figured out how to do it and it's pretty simple.
Instead of using NATURAL LEFT JOIN on multiple tables, you simply daisy
chain a series of LEFT JOINS (using the ON clause) thus LEFT JOIN'ing
one onto another onto another.
Andy Budd
http://www.message.uk.com/
More information about the thelist
mailing list