query help

From: Jeff Patterson <jpat(at)mpip(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: query help
Date: 2001-09-07 15:09:21
Message-ID: 3B98E321.BD925DA2@mpip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-announce pgsql-general

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

In response to

Browse pgsql-announce by date

  From Date Subject
Next Message Micah Yoder 2001-09-07 19:02:40 Re: Great Bridge ceases operations
Previous Message Andrew Gould 2001-09-07 12:57:44 Re: Great Bridge ceases operations

Browse pgsql-general by date

  From Date Subject
Next Message Joe Conway 2001-09-07 15:18:46 Re: Idea: jobs.postgresql.org
Previous Message Roderick A. Anderson 2001-09-07 14:42:42 Idea: jobs.postgresql.org