#### JOIN 3 TABLES ####
3 table join

SELECT prt.uid,prt.title as prt_title,prt.image,prt.description,prt.features,prt.surrounding,prt.address,cat.title as cat_title ,pc.name FROM tx_property_property prt
LEFT JOIN tx_property_category cat ON prt.category = cat.uid
LEFT JOIN tx_property_city pc ON pc.uid = prt.city
WHERE prt.deleted=0 and prt.hidden=0 and cat.deleted=0 and cat.hidden=0 and prt.uid=15

3 table join using typo3 structure

$res =    $TYPO3_DB->execSELECTquery(‘prt.uid,prt.title as prt_title,prt.image,prt.description,prt.features,prt.surrounding,prt.address,cat.title as cat_title,cty.name’ ,’tx_property_property prt LEFT JOIN tx_property_category cat ON prt.category = cat.uid LEFT JOIN tx_property_city cty ON cty.uid = prt.city’,”prt.deleted=0 and prt.hidden=0 and cat.deleted=0 and cat.hidden=0 and prt.uid=”.$_REQUEST[‘tx_property’][‘tt_property’]);

Advertisements