I have a one-to-many relationship with a table structure like so:
create table call(
uid serial,
store int,
...)
create table status(
call_uid int,
status_uid int,
...)
First off, please note that the "call" table will get large ( growing by up
to 6k records per week) and the status table will grow linearly with it (n*20
or so).
With that in mind, what I am trying for is an efficient query to get a tuple
set like so:
store number_of_calls number_of_status_where_statusuid_iszero
I can get 1&2:
select store, count(*) from call group by store;
or 1&3:
select c.store,count(s.status_uid)
from call c, status s
where s.call_uid=c.uid and s.status_uid=0
group by c.store
But all my lame attempts at getting both in the same query fail.
TIA
_________________________
Richard Rowell
rwrowell@bellsouth.net