X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id AEAEFD8275 for ; Sun, 11 Sep 2005 19:36:21 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 64182-08 for ; Sun, 11 Sep 2005 22:36:16 +0000 (GMT) Received: from vms048pub.verizon.net (vms048pub.verizon.net [206.46.252.48]) by svr1.postgresql.org (Postfix) with ESMTP id C496ED8220 for ; Sun, 11 Sep 2005 19:36:14 -0300 (ADT) Received: from [192.168.1.13] ([151.200.114.102]) by vms048.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix 0.04 (built Dec 24 2004)) with ESMTPA id <0IMO009VTC4BMNG0@vms048.mailsrvcs.net> for pgsql-sql@postgresql.org; Sun, 11 Sep 2005 17:36:12 -0500 (CDT) Date: Sun, 11 Sep 2005 18:37:52 -0400 From: Ferindo Middleton Jr Subject: showing multiple reference details from single query To: pgsql-sql@postgresql.org Reply-To: fmiddleton@verizon.net Message-id: <4324B1C0.7060407@verizon.net> Organization: Sleek Collar MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.531 required=5 tests=[AWL=-0.219, DNS_FROM_RFC_ABUSE=0.374, DNS_FROM_RFC_POST=1.376] X-Spam-Level: * X-Archive-Number: 200509/121 X-Sequence-Number: 22668 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