From: | Patrick JACQUOT <patrick(dot)jacquot(at)anpe(dot)fr> |
---|---|
To: | pgsql-sql(at)postgreSQL(dot)org |
Subject: | Re: [SQL] SubSelect as a column |
Date: | 2000-02-08 09:19:23 |
Message-ID: | 389FDF9A.8596E7C1@anpe.fr |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-sql |
Tom Lane wrote:
> 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
>
> ************
i would do an UNION of the tuples coming from the joint
with the tuples from "users" who don't have a counterpart in "ticket",
using "not exists" and adding to them a zero count.
Hoping it will help
regards
P.Jacquot
From | Date | Subject | |
---|---|---|---|
Next Message | Brian Piatkus | 2000-02-08 11:22:42 | Large Database & Indexes (Indices?) |
Previous Message | s266 | 2000-02-08 08:22:07 |
From | Date | Subject | |
---|---|---|---|
Next Message | Radhesh Mohandas | 2000-02-08 11:32:38 | Efficiency |
Previous Message | Nikolay Mijaylov | 2000-02-08 07:30:27 | Re: [SQL] SubSelect as a column |