Search for data in a similar field in a related table, too

From: "szucs" <janos(dot)szucs(at)meei(dot)hu>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: Search for data in a similar field in a related table, too
Date: 2003-09-10 09:26:27
Message-ID: 000501c3777d$9dd1de20$8e00a8c0@meei.hu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I have 2 tables:

MainTable, fields: id, data1
RelatedTable, fields: id, data2

RelatedTable is joined to MainTable via the 'id' field.
Field 'data2' in RelatedTable holds the same sort of data as 'data1' in
MainTable, though they may be different in length.

I could not figure out an SQL query, which returns all records where either
'data1' in the MainTable or 'data2' in the joined RelatedTable complies with
a common search condition.
(For the case of simplicity I did not mention that MainTable has more
fields, for which separate seach conditions may apply)

Is it possible to construct such an SQL query?

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Stuart Woodward 2003-09-10 09:26:53 Re: R駱.
Previous Message Erwan DUROSELLE 2003-09-10 07:50:02 Rp. : How to opimize the insertion of data