OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Re: select

From: Sebastian Mendel (listssebastianmendel.de)
Date: Fri Jan 18 2008 - 07:46:22 CST


Hiep Nguyen schrieb:
> hi all,
>
> i have a table looks like this:
>
> ID sDate
> 1 1997-03-21
> 2 1997-04-30
> 3 1997-05-30
> 4 1998-01-29
> 5 1998-02-24
> 6 1998-03-21
> 7 1999-05-10
> 8 1999-07-12
> 9 1999-10-20
> 10 2000-01-01
> 11 2000-02-15
> 12 2000-03-20
> 13 2000-05-18
>
>
> how do i construct my select statement so that i only get distinct year?
> so the above data will return something like this:
>
> sDate
> 2000
> 1999
> 1998
> 1997

did your tried:

SELECT DISTINCT YEAR(`sDate`);

--
Sebastian

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql