[thelist] Joining tables... in MySQL

Sarah Adams mr.sanders at geekjock.ca
Wed Apr 4 09:10:09 CDT 2007

> I want to list all job types, and IF there's any corresponding with
> the jobs table, I want to marry them up.
> I've used this:
> 	SELECT jobType.name, jobs.user, jobs.jobNo, jobs.jobType, jobs.hours, jobs.day
> 	FROM jobType
> 	RIGHT JOIN jobs on
> 	jobs.jobType = jobType.id
> But I'm only getting results if there's the Jobtype id in the jobs table..

I think what you need is "LEFT JOIN" instead of "RIGHT JOIN".

sarah adams
web developer & programmer
portfolio: http://sarah.designshift.com
blog: http://hardedge.ca

More information about the thelist mailing list