i run query:
select sites.id, count(channels.id) sites left join channels on channels.site_id = sites.id group sites.id
..and result: 1000:0; 1001:26; 1002:0; etc
i want include channels active = 1, when add criterion sites 0 channels no longer show.
how list sites , channel counts channels.active = 1?
thanks in advance.
make sure include check on active in left join so:
select sites.id, count(channels.id) sites left join channels on sites.id = channels.site_id , 1 = channels.active group sites.id
Comments
Post a Comment