Обсуждение: Three table query

Поиск
Список
Период
Сортировка

Three table query

От
Brian
Дата:
Sorry, first post with no topic.

Given 3 tables:
---------------
Table Operations(Op)
Op_ID, Op_Name,...

and

Table TravelerHEADER(TravH)
TravH_ID, TravName, Part_ID,...

and

Table TravelerDETAIL(TravD)
TravD_ID, TravH_ID, Op_ID, TravOrder,...

How can I retrieve the OP RecordSet
associated with the subset of TravD records
given a single TravH_ID?

That is to say:
There are a finite set of travd records that relate to a singular travh record... for each of those travd records I
wantthe related Op record. 

Stumped again,
Brian


Re: Three table query

От
Frank Bax
Дата:
select travh.*, travd.*, op.* from travh, travd, op where travd.travh_id =
travh.travh_id and op.op_id = travd.op_id and travh.travh_id = 'whatever';

At 04:58 PM 12/22/01 -0800, Brian wrote:
>Sorry, first post with no topic.
>
>Given 3 tables:
>---------------
>Table Operations(Op)
>Op_ID, Op_Name,...
>
>and
>
>Table TravelerHEADER(TravH)
>TravH_ID, TravName, Part_ID,...
>
>and
>
>Table TravelerDETAIL(TravD)
>TravD_ID, TravH_ID, Op_ID, TravOrder,...
>
>How can I retrieve the OP RecordSet
>associated with the subset of TravD records
>given a single TravH_ID?
>
>That is to say:
>There are a finite set of travd records that relate to a singular travh
record...
>for each of those travd records I want the related Op record.
>
>Stumped again,
>Brian
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 2: you can get off all lists at once with the unregister command
>    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)