You are here: Re: select question « PHP Language « IT news, forums, messages
Re: select question

Posted by Kurt on 03/07/07 18:38

paulfredlein@NOSPAMoptusnet.com.au (Paul) wrote in
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
>

Maybe...

select * from highscores order by score desc limit 1;

or
select * from highscores where score = (select MIN(score) from highscores);


Kurt
--
NNTPjunkie.com Usenet
30 GB $9.95 monthly

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация