Re: [SQL] SubSelect as a column - Mailing list pgsql-general

From Nikolay Mijaylov
Subject Re: [SQL] SubSelect as a column
Date
Msg-id 003a01bf7206$6031a620$ce2a18c3@skillbrokers.bg
Whole thread Raw
List pgsql-general
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
>
> ************


pgsql-general by date:

Previous
From: Marten Feldtmann
Date:
Subject: Re: [SQL] Re: [HACKERS] Proposed Changes to PostgreSQL
Next
From: "s266"
Date:
Subject: