Re: [SQL] SubSelect as a column

From: Lars <lars(at)sscsinc(dot)com>
To: Patrick JACQUOT <patrick(dot)jacquot(at)anpe(dot)fr>
Cc: pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] SubSelect as a column
Date: 2000-02-08 19:08:11
Message-ID: Pine.BSF.4.10.10002081103040.56244-100000@maximillion.sscsinc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

Thanks, I will give that a try. Hopefully the NOT EXISTS will not be too
slow. It is my understanding, I could be very wrong, that NOT EXISTS will
not take advantage of my indexes.

On another note, any idea when PostgreSQL 7 will be released? It sure
would be nice to have the subselect as a colunm feature.

Thanks,

-Lars

On Tue, 8 Feb 2000, Patrick JACQUOT wrote:

> 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
>
>
> ************
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Marten Feldtmann 2000-02-08 20:23:11 Re: [GENERAL] using ID as a key
Previous Message flbeto 2000-02-08 18:33:58

Browse pgsql-sql by date

  From Date Subject
Next Message Javi Piol 2000-02-09 00:40:16 POR FIN DINERO REAL SIN TRAMPAS
Previous Message Jan Wieck 2000-02-08 16:04:28 Re: [SQL] Problem with PL/pgSQL