|
Posted by Hilarion on 10/07/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]
|