Subject | Join to same table |
---|---|
Author | adele_leroux |
Post date | 2004-04-22T13:13:53Z |
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
TableA would look something like this...
ID,Description,LinkID
1,AAA,2
2,BBB,3
3,CCC,1
and the query should return...
1,AAA,2,BBB
2,BBB,3,CCC
3,CCC,1,AAA
but the query actually returns...
null,null,null,null
null,null,null,null
null,null,null,null
any suggestions?
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
TableA would look something like this...
ID,Description,LinkID
1,AAA,2
2,BBB,3
3,CCC,1
and the query should return...
1,AAA,2,BBB
2,BBB,3,CCC
3,CCC,1,AAA
but the query actually returns...
null,null,null,null
null,null,null,null
null,null,null,null
any suggestions?