Re: Left Join with more than two tables......

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

 



Thanks.  I couldn't find the correct syntax in my resources.  I tried at one
point to use commas like:

select * from table1
left join table2,table3 on table1.id=table2.id,table1.id=table3.id

Thanks again for the correct syntax.

On Tuesday 12 August 2003 04:00 pm, Brent Baisley wrote:
> The left join works the same for two or more tables.
> select * from table1
> left join table2 on table1.id=table2.id
> left join table3 on table1.id=table3.id
> ...
>
> Just specify the table you want to join and what to use to join them.
>
> On Tuesday, August 12, 2003, at 03:16 PM, Michael Cortes wrote:
> > I know that we can ......
> >
> > select last_name,first_name, table2.school from table1 left join
> > table2 on
> > school_id=bldg_id
> >
> > Listing all students and giving the school name for all students, if
> > they have
> > one.  If not, it lists the kid anyway and leaves that field blank.
> >
> > Anyhow, how about multiple tables?  I can't find it with google.
> >
> > I have :
> > table1 with the students
> > table2 with library PINs and an autoincrement id
> > table3 with a lunch status and an autoincrement id
> >
> > I want to list all students (I will select just certain fields)  but
> > if they
> > have it, I want to list the PIN from table2 and the lunch status from
> > table3.
> >
> > I can do it as a join but then anystudent who doesn't cross-reference
> > gets
> > left out.  I need to list all students.

--

Michael Cortes
Fort LeBoeuf School District
34 East Ninth Street
PO Box 810
Waterford PA 16441-0810
814.796.4795


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