| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Jens Hartwig <jhartwig(at)debis(dot)com> |
| Cc: | Tod McQuillin <devin(at)spamcop(dot)net>, Nikolaj Lundsgaard <Nikolaj(at)konfus(dot)dk>, pgsql-sql(at)postgresql(dot)org |
| Subject: | Re: Sv: how to build this query ??? Please help !!! |
| Date: | 2001-01-04 09:46:27 |
| Message-ID: | 21122.978601587@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
Jens Hartwig <jhartwig(at)debis(dot)com> writes:
> I have never seen a statement like
> SELECT a, (SELECT b)
> FROM xyz;
> IMHO this is no normal subselect and it does not correlate with the
> SQL-standard. Is it a trick?
I think it's OK (we're assuming that a and b are columns of xyz, right?)
The inner select sees values from the outer select as constants. This
is not really different from
SELECT x FROM xyz WHERE y IN
(SELECT a FROM abc WHERE b = xyz.z);
where the inner WHERE relies upon an outer reference to the current
xyz tuple.
It is true that "SELECT b" isn't a valid SQL92 SELECT because it
hasn't got a FROM clause, but that's a minor quibble that just about
every vendor has invented a workaround for.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Jens Hartwig | 2001-01-04 11:13:54 | Re: Sv: how to build this query ??? Please help !!! |
| Previous Message | Jens Hartwig | 2001-01-04 08:42:14 | Re: Sv: how to build this query ??? Please help !!! |