我有这个问题:
SELECT c.id, c.title AS label, m.url, img.filename, img.set_id,
m.keywords AS meta_keywords, m.keywords_overwrite AS meta_keywords_overwrite,
m.description AS meta_description, m.description_overwrite AS meta_description_overwrite,
m.title AS meta_title, m.title_overwrite AS meta_title_overwrite, m.data AS meta_data
FROM photogallery_categories AS c
INNER JOIN photogallery_categories_albums AS ca ON ca.category_id = c.id
INNER JOIN photogallery_albums AS i ON i.id = ca.album_id
INNER JOIN photogallery_sets_images AS img ON i.set_id = img.set_id
INNER JOIN meta AS m ON m.id = c.meta_id
WHERE c.language = ? AND i.hidden = ? AND i.publish_on <= ? AND i.num_images > 0
GROUP BY c.id ORDER BY i.sequence DESC, img.sequence DESC
但我的ORDER BY完全被忽略了? 有关如何解决此问题的任何建议吗?
答案 0 :(得分:1)
尝试将 i.sequence 添加到字段列表中。另外,为什么你使用GROUP BY,因为你没有包含任何聚合函数?你能用DISTINCT而不是GROUP BY吗?