Subject | Re: [firebird-support] join and columns with the same name on diferent tables |
---|---|
Author | Helen Borrie |
Post date | 2004-04-06T00:31:02Z |
At 01:48 PM 5/04/2004 -0300, you wrote:
You'd have got the warning if you had either
Select t1.* or select t2.*
client. Are you using the correct client?
library...while isql is finding the right client library.
btw, re-read your original message to see why I'm confused about whether
this posting is discussing Fb 1.5 or Fb 1.0.3 behaviour.
/heLen
>Hi guys !That bug got fixed when the Win32 kit was replaced. So...
>
>This weekend I wrote by mistake a query without the alias on the fields.
>Take a look
>
>Firebird SS 1.5.0.4290 on WinXP (I know I should upgrade to the other
>build... But AFAIK the problem is with ISQL and the needed to do <ENTER>
><ENTER> to execute the statments)
>I tested on a remote server runnning FB 1.0.3 and got the same results...Not with a cross-join. Select * on a joined set is a cross-join.
>
>create table Table1(id integer, Number integer, Name varchar(20));
>create table Table2(id integer, Table1ID integer, Number varchar(20));
>
>insert into Table1 values (1, 1, 'ABC');
>insert into Table1 values (2, 2, 'DEF');
>insert into Table1 values (3, 3, 'GHI');
>
>insert into Table2 values (1, 1, '10');
>insert into Table2 values (2, 2, '25');
>insert into Table2 values (3, 3, '20');
>insert into Table2 values (4, 3, 'Km 26');
>
>
>this Query
>
>select
> *
>from
> Table1 T1 join
> Table2 T2 on (T2.Table1ID = T1.ID)
>where
> Number between 2 and 3
>
>gives me:
>
>Conversion error from String "Km 26"
>
>I know i forgot to put alias on the where clause, to get the correct
>resultset I should make it:
>
>select
> *
>from
> Table1 T1 join
> Table2 T2 on (T2.Table1ID = T1.ID)
>where
> T1.Number between 2 and 3
>
>That's ok, but don't should FB tell me that I have an "Ambiguous Field" in
>this query
You'd have got the warning if you had either
Select t1.* or select t2.*
>If I write this:That query gives me an exception with Fb 1.0.3 using the Fb 1.0.3
>
>Select
> Number
>from
> Table1 T1 join
> Table2 T2 on (T2.Table1ID = T1.ID)
>
>I get
>
>10
>25
>20
>km 26
>
>Wich is values from table Table2. If I recall correct on FB 1.0 was made a
>correction to prevent users to write bad SQL that uses Fields from tables
>with the same name without an alias... This correction broke some
>applications (IBReplicator, IBConsole) that don't put alias on all
>queries... Or I am missing things here...
client. Are you using the correct client?
>I know how to correct the query, i just forgot to put alias... What I wantIt does.
>to know is if it's the correct behaviour.
>
>In this case FB should give an error right ????
>I just did another test...It seems to be another indication that you are using the wrong client
>
>In ISQL I got an warning:
>SQL warning code = 204
>-Ambiguous field name between table TABLE1 and table TABLE2
>-NUMBER
>
>In IBOConsole and IBConsole no warnings...
library...while isql is finding the right client library.
btw, re-read your original message to see why I'm confused about whether
this posting is discussing Fb 1.5 or Fb 1.0.3 behaviour.
/heLen