how to get max 10 records from table

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mianmajidali
Forum Commoner
Posts: 30
Joined: Tue Dec 01, 2009 8:05 pm

how to get max 10 records from table

Post by mianmajidali »

hi to all,
i m making a raking star module, there was a field total_vote that increases when ever anyone make ranking,,, i want to get 10..or 20 whatever strength....that will have maximum values...please tell me the SELECT query to select that field's top 20 records...

thanks in advance
mikosiko
Forum Regular
Posts: 757
Joined: Wed Jan 13, 2010 7:22 pm

Re: how to get max 10 records from table

Post by mikosiko »

you can use the ORDER and LIMIT clauses to do that
Post Reply