You are here: Re: slightly OT, sql question « PHP Language « IT news, forums, messages
Re: slightly OT, sql question

Posted by Hilarion on 09/30/79 11:24

Kleist <kleist@tlen.pl> wrote:
> I have a table like this:
>
> ID | prod_nr | rate
> ----|----------|------------
> 1 | 23 | 8
> 2 | 29 | 11.3
> 3 | 230 | 3
> 4 | 23 | 16.2
> 5 | 23 | 4
>
> I am new in sql, and don`t know how to get list of
> ID's for distinct list of prod_nr. I need to have the result
> like this.
>
> res_id
> -------
> 1
> 2
> 3


Try this:

SELECT MIN( id ) AS res_id
FROM some_table
GROUP BY prod_nr
ORDER BY 1


Hilarion

 

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

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