Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: mistake, error, or something else ?
Mike wrote:
>
> On Mon, 27 Oct 2003 14:26:26 +0000 (UTC), Rob Cowell
> <rjc4687_at_hotmail.com> wrote:
>
> >But it is 'sucessful'. Well it won't retrieve anything, but it's valid
> >syntax.
> >
> >(select distinct c from t2)
> >
> >in this sub query is the same as
> >
> >(select distinct t1.c from t2)
> >
> >and that's legal, but fairly useless code.
>
> i've understand, but it's not much logical
>
> can you explain me why parser consider the column named in subquery
> like a column owned by t1 and not by t2 ?
>
> Tia
>
> Mike
Because a sub query can reference columns from tables in the main query. The parser would consider the column if it existed in t2. But it knows column c doesn't exist in t2, so assumes you mean column c in t1 which is also in the scope of the sub query. Received on Mon Oct 27 2003 - 08:36:42 CST