[thelist] Joining tables... in MySQL
Tris
beertastic at gmail.com
Wed Apr 4 09:31:58 CDT 2007
it's my WHERE clause that's causing the grief..
SELECT jobType.name, jobs.user, jobs.jobNo, jobs.jobType, jobs.hours, jobs.day
FROM jobs
LEFT JOIN jobType on
jobs.jobType = jobType.id
WHERE
jobs.user = '4' AND
jobs.week = '2007-03-19' AND
jobs.day = '2'
Take it out and I get plenty of NULL results...
Hmmmm
On 04/04/07, Mark Groen <evolt at markgroen.com> wrote:
> On Wednesday 04 April 2007 07:10, Sarah Adams wrote:
> > >.........
> > I think what you need is "LEFT JOIN" instead of "RIGHT JOIN".
>
> >From what is described as the output needed, think you are correct Sarah.
> Here's an explanation for Tris about each type of join, and the results to
> expect, no Rudy required:
>
> <http://www.wellho.net/mouth/158_MySQL-LEFT-JOIN-and-RIGHT-JOIN-INNER-JOIN-and-OUTER-JOIN.html>
> --
> cheers,
>
> mark
> --
>
> * * Please support the community that supports you. * *
> http://evolt.org/help_support_evolt/
>
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !
>
--
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