[thelist] Joining tables... in MySQL

Matt Warden mwarden at gmail.com
Wed Apr 4 09:27:25 CDT 2007

On 4/4/07, Joost van Velzen <joost at nr6.nl> wrote:
> SELECT * FROM jobType, jobs WHERE jobType.id = jobs.jobType
> /me doesn't understand why so many people try to force themselves into
> left/inner/right joins when you can just say "where this is that"

Perhaps because you *must* use that syntax in the case of
non-inner-joines? Your proposed solution will not work. He needs all
jobTypes, regardless of whether there are any jobs for that type. That
requires an outer join.

He almost had it, but he tried to use RIGHT JOIN. RIGHT JOIN is
utterly useless and just adds confusion to the mix. It is more natural
to formulate the join as a LEFT JOIN. Sarah was spot on with her

Matt Warden
Cleveland, OH, USA

This email proudly and graciously contributes to entropy.

More information about the thelist mailing list