我需要在以下查询中进行 Distinct 搜索:
$listings = $this->Listing->query("SELECT DISTINCT(Listing.listnumber),Listing.*, ClientEvent.*, Client.*, UserLog.*, Agent.* FROM listings Listing
LEFT JOIN client_events ClientEvent ON ClientEvent.listnumber = Listing.listnumber
LEFT JOIN clients Client ON Client.clnt_id = ClientEvent.clnt_id
LEFT JOIN user_logs UserLog ON UserLog.ul_item_id = Listing.listnumber
LEFT JOIN agents Agent ON Agent.agnt_id = Listing.agnt_id
WHERE Listing.off_id = '{$off_id}' AND (UserLog.ul_type = 'listing.new_listing' OR Listing.listnumber LIKE '3330%')");
但是,这给了我正确的结果,但重复。我需要不同的结果。
有任何想法吗?