Re: Seleting records

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Simon Allison wrote:

> Hello,
> 
>  
> 
> My news table has a year field as such
> 
>  
> 
> Year
> 
> --------
> 
> 2000
> 
> 2000
> 
> 2001
> 
> 2001
> 
> 2003
> 
> 2005
> 
> 2005
> 
>  
> 
> I was wondering if you could select from this table so you only get one of
> each year, so the output would be
> 
>  
> 
> 2000
> 
> 2001
> 
> 2003
> 
> 2005
> 
>  
> 
> Is this possible, I was trying to think of an algorithm that would work,
> but I have had no luck yet?

Use mysql DISTINCT

SELECT DISTINCT(year-field) FROM table

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux