Received: from server.cherry.crk ([207.168.131.5]) by postgresql.org (8.11.3/8.11.4) with ESMTP id f87FUA731586 for ; Fri, 7 Sep 2001 11:30:11 -0400 (EDT) (envelope-from jpat@mpip.org) Received: from mpip.org (IDENT:jpat@server.cherry.crk [192.168.2.1]) by server.cherry.crk (8.9.3/8.9.3) with ESMTP id IAA15519 for ; Fri, 7 Sep 2001 08:09:21 -0700 Message-ID: <3B98E321.BD925DA2@mpip.org> Date: Fri, 07 Sep 2001 08:09:21 -0700 From: Jeff Patterson X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.2.14-VA.2.1smp i686) X-Accept-Language: en MIME-Version: 1.0 To: pgsql-general@postgresql.org Subject: query help References: <200109070443.f874h7D27286@candle.pha.pa.us> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200109/493 X-Sequence-Number: 15130 This seems like such a basic function that I'm sure I am missing something fundamental. I have a table, say xref, whose columns are primary key values for other tables. Some of theses keys may be NULL for a given row in xref. I want to create a query that returns the corresponding entries in the other tables. xref: drug_id | function_id|syst_id |text_id -------------------------- d0001 | 2 | 3 | 3423 d0001 | 5 | | 5678 d0056 | 3 | 5 | system_id: syst_id | syst_desc -------------- 3 | renal 4 | hepatic 5 | respiratory clinical_text: text_id| clinical_text -------------- 3423 | 'some medical mumbo jumbo' 5678 | 'more of the same' I want the syst_desc and clinical_text (plus other similar data from tables not shown) given a drug_id and function_id. Any help? Thanks a bunch, Jeff Patterson The Melanoma Patients' Information Page http://www.mpip.org