We have many kinds of advertisers in our web service:
1.private
2. companies, of which some are members of local enterpreneur community
3. non-profitable communities
Company advertisers can select also a "line of business" while for others
its unavailable. We have a menu where we want to put all the lines of
business in alphabetical order WITH the information, how many companies
(that are ALSO members of local enterpreneur community) are in that line of
business. I made the query following some model. It looked like working,
but now I noticed it doesn't right results always:
SELECT business_lines.*,
IF(seller_id <> 'NULL' AND seller_type='company' AND
seller_membership="LocalEnt", count( * ), 0) as nr_of sellers_in_this_line
FROM business_lines
LEFT OUTER JOIN sellers ON line_id=seller_line_id
GROUP BY line_id
ORDER BY line_name asc
So I suspect that if not ALL companies int certain line are members, that
line results to enpty line. Is that true and how to fix this?