0
我有這樣的MySQL查詢集團通過限2臺
select * from {$this->table} sc
join db_sc_profile scp
on scp.subcategory_id = sc.subcategory_id
join db_profile p
on p.profile_id = scp.profile_id
where sc.subcategory_id in (" . implode(',', $subcategories) . ")
and p.profile_id in (" .implode(',', $profiles) .
group by p.profile limit ####
此查詢不與該行group by p.profile limit ####
工作。所以 我想分組p.profile
但限制爲12/count(profiles)
。
我可以那樣做嗎?請任何幫助。
注:我使用的是笨2
1:你嘗試了嗎? 2:在倒數第二行有一個語法錯誤(在連接implode之後不要重新打開雙引號)。 – 2013-02-18 17:55:38
給我們一個輸入樣本和預期輸出。 – Achrome 2013-02-18 17:59:29
是的,我知道這是工作,我修改它只是爲了向你展示如何添加組和限制。我可以解釋:我想要例如6個子類別的個人資料 – 2013-02-18 18:00:12