Received: from photon.skillbrokers.bg (root@photon.skillbrokers.bg [195.24.42.194]) by hub.org (8.9.3/8.9.3) with ESMTP id CAA44773 for ; Tue, 8 Feb 2000 02:34:16 -0500 (EST) (envelope-from nmmm@nmmm.nu) Received: from niki (proton.skillbrokers.bg [195.24.42.206]) by photon.skillbrokers.bg (8.9.0/8.9.0) with SMTP id KAA10528; Tue, 8 Feb 2000 10:26:27 +0200 Message-ID: <003a01bf7206$6031a620$ce2a18c3@skillbrokers.bg> From: "Nikolay Mijaylov" To: "pgsql-general" , "Tom Lane" References: <27709.949980829@sss.pgh.pa.us> Subject: Re: [SQL] SubSelect as a column Date: Tue, 8 Feb 2000 09:30:27 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: 8bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Define this as function: SELECT COUNT(t.techid) FROM ticket t WHERE t.techid = $1 Then use this.... SELECT u.idnum, u.username, func(u.idnum) FROM users u; -------------------------------------------------------------- The reboots are for hardware upgrades! "http://www.nmmm.nu; ----- Original Message ----- From: Tom Lane To: Lars Cc: Sent: вторник, Февруари 08, 2000 05:33 Subject: Re: [SQL] SubSelect as a column > 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 > > ************