Hi Folks,
I have two tables
roster holds the duties to be performed and the number of people required per
duty.
roster_staff holds the people allocated to perform that duty.
I'm trying to create a select that will tally the roster_staff and include it
with the roster details. I've managed to get it working for a specific day,
but I can't seem to manage to get it working generically.
here's the select I've got that works, along with the output:
nymr=# select r.*, s.tally from roster r,
nymr-# (select count(*) as tally from roster_staff where
nymr(# rsdate = '2002-01-01' and rsgid = 11 and rsgsid = 2) as s
nymr-# where rodate = '2002-01-01' and rogid = 11 and rogsid = 2; rodate | rogid | rogsid | rorequired |
rooptional| tally
------------+-------+--------+------------+------------+-------2002-01-01 | 11 | 2 | 0 | 1 |
2
(1 row)
nymr=#
What I want to be able to do is select multiple rows and have the correct
tally appear for that row.
--
Gary Stainburn
This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000