...

View Full Version : selecting the top 3 values from a database



king2k5
03-11-2009, 11:27 PM
I'm wondering if this is even possible to do. I want to retrieve the top 3 scores from a database. I'm thinking MAX() but i cant wrap my head around the logic needed to do this. Is it possible to retrieve the top 3 values from a database? I'm sorry i dont have a snippet to post, i just really cant think of how to go about doing it. Any help would be very much appreciated :)

shadowmaniac
03-11-2009, 11:33 PM
Should probably have posted this in the MySQL forum. In any case, I don't know what your DB looks like but just do a search and sort by desc order based on the scores and then use "Limit 3" to get the top 3 values.

king2k5
03-11-2009, 11:37 PM
Limit 3, thank you! I knew i knew how to do this.. I just couldnt think of it... brainfart. Thanks again :)

rafiki
03-12-2009, 12:53 AM
Also ORDER BY the row name to get the top 3 of a different row.
Thanks.
Rafiki.

Fou-Lu
03-12-2009, 02:10 AM
Moving to MySQL.
Also, LIMIT is a proprietary command. Selecting a limited count is dbms dependant.

oesxyl
03-12-2009, 04:40 AM
Moving to MySQL.
Also, LIMIT is a proprietary command. Selecting a limited count is dbms dependant.
yes you are right, :)
anyway, few solution to this problem:

http://www.petefreitag.com/item/59.cfm

best regards



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum