inner join

inner join

am 21.10.2007 14:07:06 von Ron Piggott

Can you inner join 3 tables together? Do you know what the syntax would be?
Ron

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

RE: inner join

am 21.10.2007 15:41:21 von Bastien Koert

select [table.field]=20
from
table1 t1 inner join table2 on t1.some_field =3D t2.some_field
inner join table3 t3 on t1.some_field =3D t3.some_field
where [clauses as needed]


bastien






----------------------------------------> From: ron.piggott@actsministries.=
org> To: php-db@lists.php.net> Date: Sun, 21 Oct 2007 07:07:06 -0500> Subje=
ct: [PHP-DB] inner join>> Can you inner join 3 tables together? Do you know=
what the syntax would be?> Ron>> --> PHP Database Mailing List (http://www=
..php.net/)> To unsubscribe, visit: http://www.php.net/unsub.php>

____________________________________________________________ _____
Are you ready for Windows Live Messenger Beta 8.5 ? Get the latest for free=
today!
http://entertainment.sympatico.msn.ca/WindowsLiveMessenger=

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

RE: inner join

am 21.10.2007 16:52:09 von Trevor Gryffyn

Along with the formal inner join syntax Bastien pointed out, isn't doing
"WHERE t1.id = t2.id AND t2.id = t3.id" the same thing?

select [table.field]
from
table1 t1, table2 t2, table3 t3
where t1.some_field = t2.some_field
and t1.some_field = t3.some_field

-TG

----- Original Message -----
From: Bastien Koert
To: Ron Piggott , PHP DB Posts

Date: Sun, 21 Oct 2007 09:41:21 -0400
Subject: RE: [PHP-DB] inner join

>
> select [table.field]
> from
> table1 t1 inner join table2 on t1.some_field = t2.some_field
> inner join table3 t3 on t1.some_field = t3.some_field
> where [clauses as needed]
>
>
> bastien
>
>
>
>
>
>
> ----------------------------------------> From:
> ron.piggott@actsministries.org> To: php-db@lists.php.net> Date: Sun, 21
> Oct 2007 07:07:06 -0500> Subject: [PHP-DB] inner join>> Can you inner
> join 3 tables together? Do you know what the syntax would be?> Ron>> -->
> PHP Database Mailing List (http://www.php.net/)> To unsubscribe, visit:
> http://www.php.net/unsub.php>
>
> ____________________________________________________________ _____
> Are you ready for Windows Live Messenger Beta 8.5 ? Get the latest for free
> today!
> http://entertainment.sympatico.msn.ca/WindowsLiveMessenger
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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

Re: inner join

am 21.10.2007 18:11:32 von Rafael Costa Pimenta

------=_Part_5767_4962331.1192983092060
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi,

you could use:

select * from pacients p
inner join clinics c on (c.idclinics = p.idclinics)
inner join state s on (p.iodstate = s.idstate)

and so on...

you can use inner join or left join this way with many tables, view,
procedures e etc..

2007/10/21, Ron Piggott :
>
> Can you inner join 3 tables together? Do you know what the syntax would
> be?
> Ron
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--
Atenciosamente,
Rafael C. Pimenta
Programador - CTT Integration Group

------=_Part_5767_4962331.1192983092060--