Hi all,
I have a table with a field of datetime (0000-00-00 00:00:00), in order
to get a unique list of what are the years available in the database
records, I use:
Select YEAR(datetime) from data group by YEAR(datetime);
which returns:
------------------
| YEAR(datetime) |
-------------------
| 1998|
| 1999|
| 2000|
| 2001|
| 2002|
| 2003|
| 2004|
|------------------|
7 rows in set (2.59 sec)
There are total of 44251 rows in the data table. Is there a better way
to get the year list?
Thanks in advance,
sheng
Comment