Re: [SQL] SubSelect as a column

From: "Nikolay Mijaylov" <nmmm(at)nmmm(dot)nu>
To: "pgsql-general" <pgsql-general(at)postgreSQL(dot)org>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: [SQL] SubSelect as a column
Date: 2000-02-08 07:30:27
Message-ID: 003a01bf7206$6031a620$ce2a18c3@skillbrokers.bg
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

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(at)nmmm(dot)nu>

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

> Lars <lars(at)sscsinc(dot)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
>
> ************

In response to

Browse pgsql-general by date

  From Date Subject
Next Message s266 2000-02-08 08:22:07
Previous Message Tom Lane 2000-02-08 03:33:49 Re: [SQL] SubSelect as a column

Browse pgsql-sql by date

  From Date Subject
Next Message Patrick JACQUOT 2000-02-08 09:19:23 Re: [SQL] SubSelect as a column
Previous Message Tom Lane 2000-02-08 03:33:49 Re: [SQL] SubSelect as a column