Re: A very simple SQL question.
Posted in 1997
In article <34849564.3B13DF09@garpac.com>, Jacob Salomon
<jake@garpac.com> writes
>Constantino Cremidis wrote:
>
>> Although I have been using SQL for some years I do not remember
>> getting this this SQL error. Can someone explain me why this is an
>> error.
>>
>> SELECT a.col1, a.col1, a.col3 FROM table1 a, table2 b
>> WHERE ^^^^^^
>> a.col1 = b.col1 AND
>> table1.col4 = "SOME_VALUE"
>> ^^^^^^>>
>> Fails with error 522 Table (table1) not selected in query.
>>
>> PS. Sorry if this is too obvious but I am just curious.
>
>Obviously, that last line needed to be:
> a1.col4 = "SOME_VALUE"
>
>Why this is an error? Looks more like a tiny glitch in the parser to
>me. If I were Informix, I would probably not put a high priority on
If the parser can use table1 and a interchangably above then parsing
select col1
from table1 a
where table1.col1 = a.col2
(a self join) becomes ambiguous. OK a more complex example is needed
but you get the idea. The language becomes undefined.
>fixing it because it looks inconsistent and would encourage unclear SQL
>(which is normally clear at first glance |:^).
>
>Just my $0.02 (US)
>
--
David Williams