You are here: Re: Seleting records « PHP « IT news, forums, messages
Re: Seleting records

Posted by David Robley on 03/17/05 06:32

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация