pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nikolay Mijaylov <nmmm@nmmm.nu>
To: pgsql-general <pgsql-general@postgreSQL.org>
To: Tom Lane <tgl@sss.pgh.pa.us>
Subject: Re: [SQL] SubSelect as a column
Date: Tue, 8 Feb 2000 09:30:27 +0200
Message-ID: <003a01bf7206$6031a620$ce2a18c3@skillbrokers.bg> (raw)
References: <Pine.BSF.4.10.10002071642050.53230-100000@maximillion.sscsinc.com>
	<27709.949980829@sss.pgh.pa.us>

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; <nmmm@nmmm.nu>


----- Original Message -----
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Lars <lars@sscsinc.com>
Cc: <pgsql-sql@postgreSQL.org>
Sent: вторник, Февруари 08, 2000 05:33
Subject: Re: [SQL] SubSelect as a column


> Lars <lars@sscsinc.com> 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
>
> ************




view thread (5+ messages)  latest in thread

Message-ID: <003a01bf7206$6031a620$ce2a18c3@skillbrokers.bg>
Permalink:  ../003a01bf7206$6031a620$ce2a18c3@skillbrokers.bg/
Also on:    postgresql.org/message-id/003a01bf7206$6031a620$ce2a18c3@skillbrokers.bg

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: nmmm@nmmm.nu, pgsql-general@postgreSQL.org, tgl@sss.pgh.pa.us
  Subject: Re: [SQL] SubSelect as a column
  In-Reply-To: <003a01bf7206$6031a620$ce2a18c3@skillbrokers.bg>
  References: <Pine.BSF.4.10.10002071642050.53230-100000@maximillion.sscsinc.com> <27709.949980829@sss.pgh.pa.us> <003a01bf7206$6031a620$ce2a18c3@skillbrokers.bg>

* 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