Subject Re: [firebird-support] Joinded Query Alias Bug
Author Helen Borrie
At 03:15 PM 17/05/2005 +0300, you wrote:

>Hi
>i am using firebird 1.5.2
>i have a strange problem about aliases with joined query
>if i join a table more times with the same sql, i get the strange results
>
>example
>======
>SELECT IRS.TIP, IRS.FISNO, IRS.CKOD, IRS.KASA,
>C1.CARIADI, C2.CARIADI FROM IRS IRS
>LEFT JOIN CARIKART C1 ON (IRS.CKOD = C1.CKOD)
>LEFT JOIN CARIKART C2 ON (IRS.KASA = C2.CKOD)
>
>this query is right
>returns
>=====
>100,15,29,7,AVALUE,AKASA
>
>but this query's result is wrong
>SELECT IRS.TIP, IRS.FISNO, IRS.CKOD, IRS.KASA,
>CARIKART.CARIADI, C2.CARIADI FROM IRS IRS
>LEFT JOIN CARIKART CARIKART ON (IRS.CKOD = CARIKART.CKOD)
>LEFT JOIN CARIKART C2 ON (IRS.KASA = C2.CKOD)
>returns
>=====
>100,15,29,7,AKASA,AKASA
>
>
>i think there is a problem with alias
>
>if i change the aliase names with a number (c1,c2) there is not a problem
>
>is this a bug or am i missing something

Don't mix table identifiers and aliases. If you need to use aliases, use
ALL aliases. I'm sure *you* probably thought 'CARIKART' would be a good
alias for 'CARIKART' but the optimizer doesn't like it.

Firebird 2 will jump out of the server and punch your nose if you try that
sort of stunt on it. :-))

./heLen