Subject | Re: Strange Query behaviour |
---|---|
Author | Adam |
Post date | 2005-12-13T22:21:26Z |
--- In firebird-support@yahoogroups.com, "Leonardo Cosmai"
<leonardo.cosmai@j...> wrote:
you the right results but 1 is not.
There is a known bug/feature? in Firebird in this sort of case.
Rule: When joining to the same table more than once, use table aliases
everywhere.
That will keep you out of trouble.
Adam
<leonardo.cosmai@j...> wrote:
>Without seeing your data, I am only assuming that Query 2 is giving
>
> Sorry.., here is the correct Query 2)
>
> Query 2)
>
> SELECT
> ANA00.ANA00CODE A,
> TAB00.TAB00TXT1 B,
> TAB01.TAB00TXT1 C
> FROM
> ANA00
> LEFT JOIN TAB00 TAB01 ON (ANA00.ANA00TAB1 = TAB01.TAB00CODE AND
> TAB01.TAB00TREC = 'BA11' AND TAB01.TAB00LNG0 = 'I')
> LEFT JOIN TAB00 ON (TAB00.TAB00CODE = ANA00.ANA00TREC AND
> TAB00.TAB00TREC = 'TANA' AND TAB00.TAB00LNG0 = 'I')
>
> A B C
> ---------------
> 1 'A' null
> 2 'B' null
>
you the right results but 1 is not.
There is a known bug/feature? in Firebird in this sort of case.
Rule: When joining to the same table more than once, use table aliases
everywhere.
That will keep you out of trouble.
Adam