MySQL - Getting Top n records and ordering by a specific column with pagination -


i have got problem getting top n records database , ordering them specific column , paginating them.

for example want first 100 movies movie table , order these first 100 records name , display 10 records per page.

however doesn't work;

select name movies order id desc, name desc, limit 0,10 

i quite confused here. in order paginate have use limit in such ways;

limit 0,10 = first page limit 10,20 = second page 

and on.

in order first records, use order id desc when want list z a, order id desc, name desc doesn't trick.

in words want first (latest) 100 records out of 10.000 , order 100 records name (asc or desc) , / or view (asc or desc).

i hope clear enough explain problem.

i glad if me out one.

shift order of order by statements (updated)

select   name      ( select    *                 movies             order id desc             limit 100 )  order name desc  limit    0,10 

it uses first 1 first , if equal looks @ next one


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -