Subject | Re: [firebird-support] Join to same table |
---|---|
Author | Arno Brinkman |
Post date | 2004-04-22T13:18:41Z |
Hi,
alias. It's recommanded to alias always every table. I guess this is the
problem here and change your query too :
SELECT
A.ID,
A.Description,
A.LinkID,
B.Description as LinkDescription
FROM
TableA A
LEFT JOIN TableA B ON (B.ID = A.LinkID)
Regards,
Arno Brinkman
ABVisie
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Firebird open source database (based on IB-OE) with many SQL-99 features :
http://www.firebirdsql.org
http://www.firebirdsql.info
http://www.fingerbird.de/
http://www.comunidade-firebird.org/
Support list for Interbase and Firebird users :
firebird-support@yahoogroups.com
Nederlandse firebird nieuwsgroep :
news://80.126.130.81
> Hi All, I am having problems executing a query that joins a table toFB does currently a bad job when mixing none alias tables and tables with a
> the same table. I execute this query in MS SQL server and it works
> fine. Firebird however returns blank (null) records
>
> SELECT TableA.ID, TableA.Description, TableA.LinkID,
> TableB.Description as LinkDescription
> FROM TableA
> LEFT JOIN TableA TableB ON TableB.ID = TableA.LinkID
alias. It's recommanded to alias always every table. I guess this is the
problem here and change your query too :
SELECT
A.ID,
A.Description,
A.LinkID,
B.Description as LinkDescription
FROM
TableA A
LEFT JOIN TableA B ON (B.ID = A.LinkID)
Regards,
Arno Brinkman
ABVisie
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Firebird open source database (based on IB-OE) with many SQL-99 features :
http://www.firebirdsql.org
http://www.firebirdsql.info
http://www.fingerbird.de/
http://www.comunidade-firebird.org/
Support list for Interbase and Firebird users :
firebird-support@yahoogroups.com
Nederlandse firebird nieuwsgroep :
news://80.126.130.81