MySql Join using 4 tables

Posted by Ionut Flavius Pogacian on Stack Overflow See other posts from Stack Overflow or by Ionut Flavius Pogacian
Published on 2012-07-03T09:12:37Z Indexed on 2012/07/03 9:15 UTC
Read the original article Hit count: 252

Filed under:

I have 4 tables and i want to join them and extarct 4 values.

I wrote the followig MySql Query, but it does not work.

select `a`.`id`,`a`.`page` xpage,`a`.`action`,
`b`.`header` xheader, `b`.`page_id`,
`c`.`content` xcontent,`b`.`page_id`,
`d`.`footer` xfooter,`d`.`page_id`
join `header` b
on `a`.`id`=`b`.`page_id`
join `content` c
on `a`.`id`=`c`.`page_id` and `a`.`id`=`d`.`page_id`
join `footer` d
on `a`.`id`=`d`.`page_id`
where `a`.`page`='main'

© Stack Overflow or respective owner

Related posts about mysql