Re: mysql_insert_id() and JOIN
| From: | Bastien Koert | Date: | Mon, 13 Jul 2009 14:46:33 +0000 |
| Subject: | Re: mysql_insert_id() and JOIN | ||
| References: | 1 2 3 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-46284@lists.php.net to get a copy of this message | ||
[snip]
> Sorry my question... but why I must use JOIN if I can use SELECT * FROM
> table1 AND table2 AND table3 WHERE table1.id=table2.id=table3 not?
> thanks
>
> +
> _
[/snip]
select table1.field1, table1.field2, table2.field3, table2.field4,
table3.field5 from
table1, table 2, table3
where table1.id=table2.id and table1.id = table3.id
vs
select table1.field1, table1.field2, table2.field3, table2.field4,
table3.field5
from
table1
inner join table2 on table1.id = table2.id
outer join table3 on table1.id = table3.id
The first statement only does INNER JOINS, the seconds allows for
INNER and OUTER joins, so its more flexible in terms of what you want
the data to be
Bastien