Discuss Getting all the months from distinct years in the MySQL Help forum on Dev Shed. Getting all the months from distinct years MySQL Help forum discussing administration, SQL syntax, and other MySQL-related topics. MySQL is an open-source relational database management system (RDBMS).
Time spent in forums: 1 Month 1 Week 2 Days 21 h 37 m 10 sec
Reputation Power: 1585
What would you want the output to look like? I can follow most of what you are saying but get lost as to how you perceive the results. For a start you'll almost certainly needing to be using GROUP BY on the year component of the date (and drop the DISTINCT).
The moon on the one hand, the dawn on the other:
The moon is my sister, the dawn is my brother.
The moon on my left and the dawn on my right.
My brother, good morning: my sister, good night.
-- Hilaire Belloc