Question:
Help with SQL. Maximum values of a table.?
Eat Moar Chikin
2010-08-03 05:53:55 UTC
I need help writing an SQL statement that finds the HIGHEST 10 values of a table. Not top where it just gives me the first 10 values in a table but the HIGHEST.
Three answers:
Steven
2010-08-03 05:56:28 UTC
SELECT * FROM table ORDER BY field DESC LIMIT 10
Flying In sky
2010-08-07 04:32:16 UTC
You can use order by clause to get the highest value you want.

http://www.sql-statements.com/sql-select-top.html
TheMadProfessor
2010-08-03 13:53:56 UTC
Visage has it right...if LIMIT doesn't work with your DBMS, try TOP instead - one of the two should work with most of the DBMS out today (if not, there's a workaround, but it's messy).


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...