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 WAA97077 for ; Mon, 7 Feb 2000 22:34:13 -0500 (EST) (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 WAA27712; Mon, 7 Feb 2000 22:33:50 -0500 (EST) To: Lars cc: pgsql-sql@postgreSQL.org Subject: Re: [SQL] SubSelect as a column In-reply-to: References: Comments: In-reply-to Lars message dated "Mon, 07 Feb 2000 16:54:48 -0800" Date: Mon, 07 Feb 2000 22:33:49 -0500 Message-ID: <27709.949980829@sss.pgh.pa.us> From: Tom Lane Lars writes: > I am trying to use a subselect as a column name, but it appears as if this > is not supported in Postgresql. Here is the query: > SELECT u.idnum, u.username, > (SELECT COUNT(t.techid) > FROM ticket t > WHERE t.techid = u.idnum) > FROM users u; Nope, doesn't work in 6.5.*. It is there in current sources for the upcoming 7.0 release. Can't think of any good workaround in 6.5... regards, tom lane