Count - return a value of zero for a null count

A

Alan Greiner

I have a field in a table that contains one of six values
(I, II, III, IV, V, or SCR) I want to do a count for each
of these values but want to return a value of zero if
there are no occurances of one of the six values within a
given grouping.

How do I accomplish this?

Thanks for your help!

Alan
 
J

jfp

use a second table listing all possible values (you perhaps have this
already for referential integrity purposes). Use an outer join (left or
right, depending on how you set it up) over the two tables - select the
field in the table i suggest (the "lookup" table) and select count(*) in
your table (the "data" table)
-=-=
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top