I normally execute the following SQL queries in PostgreSQL 9.1 sequentially via psycopg2 every couple of seconds:
select count(type) from bag where type= 'fruit';
select count(type) from bag where type= 'vegtable';
select count(type) from bag where type= 'other';
select count(type) from bag where type= 'misc';
Is it possible to do the same thing in a single select query such that I get a count for each type even if that count is zero. The following would work if it gave me the zero counts when there are zero for a given type.
select type, count(*) from bag group by type;
Thank you,