Subject Re: [firebird-support] Join to same table
Author Milan Babuskov
adele_leroux wrote:

> Hi All, I am having problems executing a query that joins a table to
> 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

Try:

SELECT TableA.ID, TableA.Description, TableA.LinkID,
TableB.Description as LinkDescription
FROM TableA a
LEFT JOIN TableA b ON b.ID = a.LinkID


HTH
--
Milan Babuskov
http://fbexport.sourceforge.net