Codes here !
Moderators: macek, egami, gesf
by nnjgmatt » Thu Apr 26, 2012 2:00 pm
Im working on a table were it displays the top 10 users on the site. Their reputation is based on a number so how do I find the 10 highest numbers in a table?
Once I figure out my answer I will post back to help others in the future.
-
nnjgmatt
- New php-forum User

-
- Posts: 6
- Joined: Mon Apr 23, 2012 2:33 pm
by minimihi » Thu Apr 26, 2012 2:18 pm
You would need to order number column from highest to lowest value and select first 10 rows.
For that you should check out
ORDER BY optimization and
LIMIT optimization for
SELECT sentence.
-

minimihi
- New php-forum User

-
- Posts: 238
- Joined: Sat Apr 14, 2012 11:57 am
- Location: Vilnius, Lithuania
by egami » Fri Apr 27, 2012 4:17 am
SELECT * FROM table ORDER BY column LIMIT 10
-

egami
- php-forum GURU

-
- Posts: 2197
- Joined: Wed Oct 06, 2010 11:19 am
- Location: Happy Valley, UT
Return to mySQL & php coding
Who is online
Users browsing this forum: No registered users and 1 guest