How can I get a unique sorted list?

Ivan Smahin ivan_smahin at valentina-db.com
Thu Oct 12 09:51:48 CDT 2006


Hello Steven,

Thursday, October 12, 2006, 9:42:13 AM, you wrote:

> Ruslan,

> I have a table with two fields eg:

> ID   points
> 4        455
> 2        343
> 4        888
> 9      1023


> It is possible to have multiple records with the same
> ID number but different points.

> I want to get a list of those with the highest number
> of points. For the above table this would be

> ID    points
> 9      1023
> 4        888
> 2        343

> However if I do cursorRef=select(ID,points from table
> ORDER BY points Desc) I will get

> ID     points
> 9      1023
> 4      888
> 4      455
> 2      343

> I want to avoid the duplicates and just select the
> highest number of points for each ID.

> Is there a way to do this within Valentina (V4WS)?


SELECT
      ID,
      max( points )
FROM
    table
GROUP BY
      id
    
-- 
Best regards,
 Ivan                            mailto:ivan_smahin ÎÁ valentina-db.com



More information about the Valentina mailing list