0
我需要一個查詢優化下面的代碼:PHP:選擇從MySQL多計數(ID)作爲一個查詢
$query = 'select count(id) as featured_ads from #___properties WHERE featured = 1 and approved =1';
$db->setQuery($query);
$featured_ads = intval($db->loadResult());
$query = 'select count(id) as wait_ads from #___properties WHERE approved =0 and canceled<>"1" ';
$db->setQuery($query);
$wait_ads = intval($db->loadResult());
$query = 'select count(id) as total_users from #__sresuad WHERE gid = 18 ';
$db->setQuery($query);
$total_users = intval($db->loadResult());
我該怎麼辦?
那麼你到目前爲止嘗試過什麼?您可能還想考慮使用Joomla API來查詢和轉義您目前沒有執行的值 – Lodder