|
Posted by ZeldorBlat on 08/04/06 17:49
Skafa wrote:
> that's too obvious :-)
> i also need to return the id.
>
> i found this to be working:
>
> select id, naam, prijs
> from tblproduct p_outer
> where prijs = (
> select max(prijs)
> from tblproduct p_inner
> group by naam
> having p_outer.naam = p_inner.naam
> )
>
> altough, when two products have the same price, both are returned.
>
If you had two products with the same price then which id would you
expect to be returned? You haven't specified, and hence you get both.
Navigation:
[Reply to this message]
|