From: Ferindo Middleton Jr <fmiddleton@verizon.net>
To: pgsql-sql@postgresql.org
Subject: showing multiple reference details from single query
Date: Sun, 11 Sep 2005 18:37:52 -0400
Message-ID: <4324B1C0.7060407@verizon.net> (raw)
I have a table (table_one) with two columns, both of which are integers
which reference the same column (on a one-to-many relationship) row back
at another table (table_two) which has more detailed info on these
integer columns:
table_one has the following columns:
id (SERIAL), column_one (INTEGER REFERENCES table_two(id)), column_two
(INTEGER REFERENCES table_two(id))
table_two has the following columns:
id (SERIAL), more_detailed_info (TEXT)
How can I write a single query which will can uniquely identify in the
result the separated values of the more_detailed_info field of
table_two? For instance, if I write the following query:
SELECT * FROM table_one WHERE id = 4 AND table_one.column_one =
table_two.id;
I'll get rows which will list the more_detailed_info fields one time for
each match but table_two has more_detailed_info for both column_one and
column_two. However the query above will only be able to show the
more_detailed_info field for column_one. How can I show the
more_detailed_info field for column_two as well on the same row,
simultaneously with that of column_one
Sorry if this is confusing. I don't know of all the technical jargon
which involves my question above.
Ferindo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: fmiddleton@verizon.net
Subject: Re: showing multiple reference details from single query
In-Reply-To: <4324B1C0.7060407@verizon.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox