Posted by Sean on 03/07/07 09:53
This should return all rows with the a score equal to the minimum.
SELECT *
FROM HIGHSCORES
WHERE SCORE IN
(
SELECT MIN(SCORE)
FROM HIGHSCORES
)
Sean
"Paul" <paulfredlein@NOSPAMoptusnet.com.au> wrote in message
news:1hum0ak.1j8yw2ucf7tm0N%paulfredlein@NOSPAMoptusnet.com.au...
> Hi,
>
> I have a mysql database which holds a list of scores. I would like to
> find the minimum score in the list and then get the detail of that
> score. I've used:-
>
> select MIN(score) from highscores;
>
> this gives me 150.
>
> select * from highscores where score = 150;
>
> then I can get the detail. Is there a way to combine this with one call?
> Something like:-
>
> select * from highscores where MIN(score);
>
> BTW, what happens if there are more than one minimum score?
>
> (Basically, I have flash game and want to create a high score list. So I
> suppose we'd have to find the minimum score in the db and if that is
> smaller than the current game score add it to the db else forget it.)
>
> Any help appreciated.
>
> Paul
>
Navigation:
[Reply to this message]
|