I wrote: >> SELECT DISTINCT Location.SortID AS Loc, LocName, JobTitle AS Job, Company AS >> Comp, Jobs.JobID, Employers.EmpID >> FROM Location >> INNER JOIN JobsLocation ON JobsLocation.LocID = Location.LocID >> INNER JOIN Jobs ON Jobs.JobID = JobsLocation.JobID >> INNER JOIN Employers ON Employers.EmpID = Jobs.EmpID >> WHERE Valid=1 AND JobTitle IS NOT NULL AND (LocName LIKE 'US-Alabama%') >> ORDER BY Loc ASC > > One more suggestion: Change the first INNER JOIN to a LEFT JOIN. > It's a little silly, since you don't really want those nulls, but it > should force Location to be selected first. The records with nulls > should be eliminated by the later inner joins, or failing that by the > JobTitle criterion. > > I thought there was a better way to control the process, but I don't > see it at the moment.
I found what I was thinking of. There are two different uses of STRAIGHT_JOIN in MySQL SQL. This is the one you need: http://www.mysql.com/doc/en/SELECT.html Instead of changing the first INNER JOIN to a LEFT JOIN, try inserting STRAIGHT_JOIN after the SELECT. It might be somewhat better than the LEFT JOIN solution. No kisses necessary. -- Keith C. Ivey <[EMAIL PROTECTED]> Tobacco Documents Online http://tobaccodocuments.org --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php