I need to pull some data on a couple thousand records, but I'm having trouble sorting the results.
SELECT IdCode, GROUP_CONCAT(' ',CONCAT(MONTHNAME(ei.StartDatetime),' ',YEAR(ei.StartDatetime)))
FROM exclusion_import_data eid JOIN exclusion_import ei ON ei.ImportId = eid.ImportId
WHERE ( IdCode IN ( '84277', '253533' ))
GROUP BY IdCode
ORDER BY RecordId ASC;
Basically I'm trying to see which months specific records appeared in our system.
253533 May 2013, November 2013, December 2013, January 2014, February 2014, March 2014, April 2014, May 2014, June 2014, August 2014, October 2013, September 2013, June 2013, July 2013, May 2013, August 2013 84277 September 2013, April 2014, May 2013, May 2014, June 2014, May 2013, March 2014, June 2013, February 2014, January 2014, July 2013, December 2013, November 2013, August 2013, October 2013, August 2014
The above query returns the correct months, separated by the idCodes, but the months are all out of order.
How can I sort the records before grouping them?