Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: mistake, error, or something else ?
Rob Cowell wrote:
>
> Daniel Morgan wrote:
> >
> > mbrugo_at_despammed.com wrote:
> >
> > >Hi people.
> > >I've this query:
> > >
> > >select a,b,c from t1
> > >where c in (select distinct c from t2);
> > >
> > >
> > >this query run succesfully BUT:
> > >
> > >select distinct c from t2
> > >give me: ora-904 Invalid column name.
> > >
> > >WHY ????
> > >
> > >i've no synonym or other objects
> > >
> > >t1 has 3 columns, a,b,c
> > >t2 has 2 columns d,e
> > >
> > >Tia
> > >
> > >Mike
> > >
> > >
> > Which part of "t2 has 2 columns d,e" would lead you to believe that
> > "select distinct c from t2" would be successful?
> >
> > --
> > Daniel Morgan
>
> 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.
Actually I think the subquery with return all distinct values for t1.c as many times as there are rows in t2.
I guess it's some weird ANSII compatibility thing? Received on Mon Oct 27 2003 - 08:32:44 CST