Received: from sss2.sss.pgh.pa.us (sss.pgh.pa.us [209.114.166.2]) by hub.org (8.9.3/8.9.3) with ESMTP id TAA19161 for ; Tue, 23 May 2000 19:32:38 -0400 (EDT) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss2.sss.pgh.pa.us (8.9.3/8.9.3) with ESMTP id TAA04749; Tue, 23 May 2000 19:32:33 -0400 (EDT) To: Joseph Shraibman cc: "pgsql-sql@postgresql.org" Subject: Re: two fields in subselect In-reply-to: <392B0BFC.BB2CD23B@selectacast.net> References: <392B0BFC.BB2CD23B@selectacast.net> Comments: In-reply-to Joseph Shraibman message dated "Tue, 23 May 2000 18:53:48 -0400" Date: Tue, 23 May 2000 19:32:32 -0400 Message-ID: <4746.959124752@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200005/111 Joseph Shraibman writes: > I want to do this: > SELECT a, (select x,y,z from table2 where table1.a = table2.w), b, c > from table1; > But postgres complains: > ERROR: Subselect must have only one field You haven't said what you expect to happen if table2 has zero or multiple matches to any one table1.a value --- but if you want a plain inner join you could do SELECT a, x, y, z, b, c from table1, table2 where table1.a = table2.w; regards, tom lane