I have a table that contains a supplier_number, and a
status_flag (y or n). There can be multiple occurances
of each supplier number.
For my report, I need to show (count) the number of
occurances of each supplier_number, and then count the
total number of status flag Y and count the total
number of status_flag N for each supplier.
I use this query :
select supplier_number, status_flag, count(*) as cnt
from table
group by supplier_number, status_flag
order by supplier_number,status_flag
However, this gives me multiple rows per supplier number, one
row for the Yes count and another row
for the N count.
But I need the report output to have one row per supplier,
listing the three columns (supplier number, total yes count, total
no count)
How do I write the query for this ?
Thanks for any help.