Link to home
Start Free TrialLog in
Avatar of BrighteyesDesign
BrighteyesDesignFlag for Afghanistan

asked on

MySQL won't show results as DESC?

I'm simply trying to display the query below in date DESC so 2012 is at the top but for some reason it's displaying ASC?

I have used the same code on another pretty much identical database fine. Any ideas why this isn't working?

SELECT id, YEAR(`eventdate`) AS 'year', MONTH(`eventdate`) AS 'month', COUNT(`id`) AS 'count'  FROM `news` GROUP BY YEAR(`eventdate`), MONTH(`eventdate`) ORDER BY YEAR('eventdate') DESC, MONTH('eventdate') DESC

Open in new window

Screen-shot-2012-04-05-at-13.18..png
Screen-shot-2012-04-05-at-13.22..png
Avatar of Meir Rivkin
Meir Rivkin
Flag of Israel image

try run the query without the id, do u get descending results?

SELECT  YEAR(`eventdate`) AS 'year', MONTH(`eventdate`) AS 'month' FROM `news` GROUP BY YEAR(`eventdate`), MONTH(`eventdate`) ORDER BY YEAR('eventdate') DESC, MONTH('eventdate') DESC
Avatar of BrighteyesDesign

ASKER

Still the same? very strange.
Screen-shot-2012-04-05-at-14.01..png
ASKER CERTIFIED SOLUTION
Avatar of johanntagle
johanntagle
Flag of Philippines image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks a million, works perfectly now