Subject | Re: FB 1.5.2 Ambiguous Column Name |
---|---|
Author | Adam |
Post date | 2005-01-26T12:02Z |
Not too sure why, but I find it a good practice to explicitly define
which table each field belongs, even when no ambiguity currently
exists. I never assume a table will not be altered to introduce an
ambiguity.
So my SQL would look something like:
select P.PersonnelNo
from Passenger P
inner join Flight F on P.FltSeqNo = F.FltSeqNo
where F.FltDate = current_date
and F.DepartFrom = ?
Adam
--- In firebird-support@yahoogroups.com, "davidalbiston"
<dalbiston@c...> wrote:
which table each field belongs, even when no ambiguity currently
exists. I never assume a table will not be altered to introduce an
ambiguity.
So my SQL would look something like:
select P.PersonnelNo
from Passenger P
inner join Flight F on P.FltSeqNo = F.FltSeqNo
where F.FltDate = current_date
and F.DepartFrom = ?
Adam
--- In firebird-support@yahoogroups.com, "davidalbiston"
<dalbiston@c...> wrote:
>example,
> FB does not catch ambiguous column names in a sub-query. For
> I want find all passengers who are boarding flights on a certaindate
> at a certain point on the route:exception.
>
> select PersonnelNo
> from Passenger P
> inner join Flight F on P.FltSeqNo = F.FltSeqNo
> where FltDate = current_date
> and DepartFrom = ?
>
> There is a DepartFrom column in both tables so FB raises an
> However if I have the same SQL in a sub-query there is no objection:
>
> select ...
> where PersonnelNo in
> (select PersonnelNo
> from Passenger P
> inner join Flight F on P.FltSeqNo = F.FltSeqNo
> where FltDate = current_date
> and DepartFrom = ?)
>
> A small point but I am converting form InterBase and am getting
> paranoid about ambiguous column names.
>
> Dave