471,073 Members | 1,449 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,073 software developers and data experts.

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 852

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 leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.