Ignore duplicates but order by an value
Posted by:
cr
Date: September 08, 2004 10:51AM
Hello,
I don't find an SQL-Statement to get the result I want :)
The content of the table is something like this:
name, text, value
-------------------
aaa dsd 1.31
aaa ads 2.87
aaa fdsf 4.54
ccc fdsf 1.51
ccc ass 6.53
ddd dsd 7.31
I want to get the values, the text of each name ordered by value
So the result should be:
ddd dsd 7.31
ccc ass 6.53
aaa fdsf 4.54
The statement I build (which is wrong :) is
SELECT name,text,value FROM table
GROUP BY name ORDER BY value DESC
It returns:
ddd dsd 7.31
ccc fdsf 1.51
aaa dsd 1.31
So it take the first name found in the table to group them, and not the one with the highes value.
Hope someone can gave me a hint.
Thanks.
Regards,
cr
P.S: mysql version is 4.0.20
Subject
Written By
Posted
Ignore duplicates but order by an value
September 08, 2004 10:51AM
September 08, 2004 01:07PM
September 08, 2004 02:21PM
September 08, 2004 11:30PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.