efficient count/join query

Поиск
Список
Период
Сортировка
От Gary Stainburn
Тема efficient count/join query
Дата
Msg-id 200302071007.28697.gary.stainburn@ringways.co.uk
обсуждение исходный текст
Список pgsql-sql
Hi folks,

I've got two tables, first a history table containing tallies for staff/jobs
prior to going live, and second a roster table showing date, diagram, job
with one record per person per job per day.  the tables are:

create table history (
hsid    int4 not null references staff(sid),
hjid    int4 not null references jobs(jid),
hcount    int4,
primary key (hsid,hjid));

create table roster (
rodate    date not null,
rogid    int4 not null references diagrams(gid),
rojid    int4 not null references jobs(jid),
rosid    int4 references staff(sid),
primary key (rodate, rogid, rojid));

What's the best/quickest/cheapest way to create a view in the format of the
history table but including the details from the roster table for all records
prior to today.

I've been looking at some form of sub-select/join scheme but as some will only
exist on the history and some will only exist on the roster while many will
exist on both.
--
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



В списке pgsql-sql по дате отправления:

Предыдущее
От: Christoph Haller
Дата:
Сообщение: Re: conversi ms-sql7 vs postgresql 7.3
Следующее
От: Tomasz Myrta
Дата:
Сообщение: Re: Lock timeout detection in postgres 7.3.1