Board index » delphi » BDE SQL Join Statement Not Working

BDE SQL Join Statement Not Working

Dear All:

Does anyone know why the following query only returns the information from
the table first listed in the statement:

----------------------------------------------
select distinct Campus, C_Description

from Identifier, TempID

where Infrastructure_ID = :Selected_ID
---------------------------------------------

The keyfield exists in both tables and according the SQL this statement
should work.

Any help will be greatly received.

Thanks,

Michael

 

Re:BDE SQL Join Statement Not Working


Quote
> Does anyone know why the following query only returns the information from
> the table first listed in the statement:
> ----------------------------------------------
> select distinct Campus, C_Description
> from Identifier, TempID
> where Infrastructure_ID = :Selected_ID
> ---------------------------------------------

It looks like a Cartesian join. So you should get data from both tables.

Select I.campus, T.C_Description
from  Identifier I, TEmpID T
where I.Infrastructure = :Selected_ID
AND I.keyfield = T.ForeignKeyfield

Other Threads