Results 1 to 8 of 8
Aug 20, 2012, 04:33 #1
- Join Date
- Aug 2004
- Taunton, UK
- 0 Post(s)
- 0 Thread(s)
Query syntax help - Query lowest result value per user
I have a database table that contains a varchar field that stores the times players have taken to complete a game. The times are effectively decimals but are stored in the database as varchars. I was given this populated database by my client.
I need to query the database to pull out a list of the top 100 lowest times however I do not want more than one result for any user.
Here is the code that I have tried but it is not working. What it appears to be doing is creating a list of the users who scored the lowest scores in the correct order but not displaying their lowest score.
Note the field fbname is a unique facebook id which identifies unique users.
Can anyone point me in the right direction please
$sql = "SELECT *, MIN(CAST(scoreTime AS DECIMAL( 30, 2 ))) AS f1 FROM score_t GROUP BY fbname ORDER BY f1 LIMIT 0 , 100";
App Development | Website Design & Development | Flash Game Development