gpt4 book ai didi

MySQL:在连接时忽略 ORDER BY?

转载 作者:行者123 更新时间:2023-11-29 14:36:25 26 4
gpt4 key购买 nike

我有这个查询:

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 被完全忽略了?关于如何解决这个问题有什么建议吗?

最佳答案

尝试将i.sequence添加到字段列表中。另外,既然没有包含任何聚合函数,为什么要使用 GROUP BY?可以使用 DISTINCT 代替 GROUP BY 吗?

关于MySQL:在连接时忽略 ORDER BY?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8940562/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com