469,081 Members | 1,871 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,081 developers. It's quick & easy.

Counting number of valid rows

We have many kinds of advertisers in our web service:
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?

Jul 20 '05 #1
0 1107

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Reply via newsgroup | last post: by
18 posts views Thread by ChadDiesel | last post: by
4 posts views Thread by BJ | last post: by
8 posts views Thread by Mike P | last post: by
3 posts views Thread by nickels | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.