我试图将最后一次左连接限制为仅1个结果
$query="SELECT a.*, cc.name AS category, ee.ezcity AS proploc
, dd.name AS statename, bb.name AS countryname
, u.logo_image AS logo_image, u.mid AS mid
, u.dealer_name AS dealer_name, u.dealer_company AS dealer_company
, u.dealer_phone AS dealer_phone, u.dealer_mobile AS dealer_mobile
, u.published AS dealerpublished, sp.tenant AS tenant
, sp.spacenum AS spacenum, sp.sf AS sf, sp.image AS tenantimage
, u.dealer_type AS dealer_type
FROM #__ezrealty as a"
. "\n LEFT JOIN #__ezrealty_catg AS cc ON cc.id = a.cid"
. "\n LEFT JOIN #__ezrealty_locality AS ee ON ee.id = a.locid"
. "\n LEFT JOIN #__ezrealty_state AS dd ON dd.id = a.stid"
. "\n LEFT JOIN #__ezrealty_country AS bb ON bb.id = a.cnid"
. "\n LEFT JOIN #__ezrealty_profile AS u ON u.mid = a.owner"
. "\n LEFT JOIN #__ezrealty_siteplan AS sp ON sp.listing_id = a.id "
. "\n WHERE $extrastring AND a.published = '1' $vacant
AND cc.access <= $my->gid $wheres "
. $order.' LIMIT '.$pageNav->limitstart.', '.$pageNav->limit;
我试过了:
. "\n LEFT JOIN (SELECT listing_id FROM #__ezrealty_siteplan LIMIT 1) sp
ON sp.listing_id = a.id"
答案 0 :(得分:0)
我认为您的结果看起来包含多于1个,因为结果不是GROUP BY任何列。