tags:

views:

41

answers:

2

I'm currently writing a Java app that interfaces with a MySQL database.
My problem is that I'm trying to write a function that fills a JComboBox with the unique year-values registered in the database.
I could use UNIQE on the date-field in the SQL query, but that would only exclude some of the dates, not all-but-one-date-per-year.
Any help would be greatly appreciated.

+4  A: 
SELECT DISTINCT YEAR(yourDateColumn) FROM yourTable;
soulmerge
+1  A: 

Use the year function

Nadia Alramli