15,076
edits
m (→SQL 查詢錯誤) |
|||
| Line 335: | Line 335: | ||
(2, 'A123', 'Bob', '推推', 5, '2024-01-02'), | (2, 'A123', 'Bob', '推推', 5, '2024-01-02'), | ||
(3, 'A123', 'Bob', '讚讚', 3, '2024-01-03'); | (3, 'A123', 'Bob', '讚讚', 3, '2024-01-03'); | ||
-- 這會報錯 | |||
SELECT | |||
id, -- 問題: 沒有在 GROUP BY 中 | |||
post_id, | |||
author, | |||
GROUP_CONCAT(content SEPARATOR "\n") AS content, -- 問題: 沒有在 GROUP BY 中 | |||
likes -- 問題: 沒有在 GROUP BY 中 | |||
FROM posts | |||
GROUP BY post_id, author; | |||
</pre> | </pre> | ||