Jens Hartwig <[EMAIL PROTECTED]> 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

Reply via email to