你好,我添加了GROUP_CONCAT函數到我的查詢和該函數殺死了我的查詢:/。 我的查詢是:GROUP_CONCAT太慢
SELECT u.username,a.user_id,a.id,a.text,a.lang as fromLang,b.lang as toLang,GROUP_CONCAT(DISTINCT b.id) AS translation_ids FROM sentence as a
INNER JOIN sentence_relationship as sr ON
(sr.sentence_id = a.id)
INNER JOIN sentence as b ON
(b.id = sr.translation_id AND a.id = sr.sentence_id)
INNER JOIN users as u ON
(u.id = a.user_id) GROUP BY a.id LIMIT 10;
該查詢有什麼問題?
您總是可以將ID作爲單獨的查詢來獲取。 – mpen
是的,我可以,但我想在一個查詢中做所有事情。 –