[thelist] Joining tables... in MySQL

Tris beertastic at gmail.com
Wed Apr 4 08:59:43 CDT 2007

Hi Rudy.. I mean everyone ;-p

i've two tables:
id (int)
name (varChar)

id (int)
user (int)
week (date)
day (int)
jobNo (int)
jobType (int)
hours (int)

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..

Anyhoo... how can I list all jobTypes, and 'fill in the gaps'?

I've googled OUTER joins, but Im getting errors...?? Hmmmmm

When a person can no longer laugh at himself, it is time for others to
laugh at him.
Thomas Szasz

More information about the thelist mailing list