Saturday, June 5, 2010

Mysql query return the count from multiple table with left join

This the MySQL query with table where home table has one to many relation with many table,
 Here is code that return the count from multiple table.

  select,h.home_name,count(n.home_id) as ncount,
count(e.home_id) as ecount,count(b.home_id) as bcount,
count(s.home_id) as scount
 from home as h left join news as n on (
left join events as e on (
left join billboard as b on (
left join store as s on( where 1

Have Dream Day

No comments:

Post a Comment