Reputation: 3543
I have this query:
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
But my ORDER BY is completely ignored? Any suggestions on how to resolve this?
Upvotes: 0
Views: 101
Reputation: 15085
Try adding the i.sequence to the field list. Also, why are you using GROUP BY, since you are not including any aggregate functions? Can you use DISTINCT instead of GROUP BY?
Upvotes: 1