RE: Complex Left Join

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



try

SELECT
 d.directorid,
 d.fname,
 d.mname,
 d.lname,
 d.title,
 d.suffix,
 d.active,
 d.function,
 m.id,
 m.directorid,
 m.committee,
 m.position,
 m.year
FROM
 directors d left outer join members  m
ON
 d.directorid = m.directorid
WHERE
AND m.year = '2006'
ORDER BY
 d.lname, d.mname, d.fname;


your original query was an inner join

Bastien




From: "Keith Spiller" <larentium@xxxxxxxxxxxx>
To: "" <php-db@xxxxxxxxxxxxx>
Subject:  Complex Left Join
Date: Mon, 31 Oct 2005 13:29:18 -0700

Hi,

Can anyone help me turn this into a left join?

I want to get all of the records from the directors table whether matches exist in the members table or not.

SELECT d.directorid, d.fname, d.mname, d.lname, d.title, d.suffix, d.active, d.function, m.id, m.directorid, m.committee, m.position, m.year FROM directors as d, members as m
WHERE d.directorid = m.directorid
AND m.year = '2006'
ORDER BY d.lname, d.mname, d.fname;

Thank you for your help...


Keith

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux