offset, limit problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jesmi
    New Member
    • Apr 2007
    • 53

    offset, limit problem

    hi,
    i have a problem in limit and offset with asc and desc

    i tried the following code:
    select * from tbl_name order by column_name asc limit 10 offset 15
    it shows the 10 rows starting from 15. what i need is to show the same result but in desc order.
    i used the code
    select * from tbl_name order by column_name desc limit 10 offset 15 which shows the 10 rows but from the end of the table.

    what shall be done to get the same result for asc and desc.
    please any body can provide the query for the same.
    with regards.
  • rski
    Recognized Expert Contributor
    • Dec 2006
    • 700

    #2
    Originally posted by jesmi
    hi,
    i have a problem in limit and offset with asc and desc

    i tried the following code:
    select * from tbl_name order by column_name asc limit 10 offset 15
    it shows the 10 rows starting from 15. what i need is to show the same result but in desc order.
    i used the code
    select * from tbl_name order by column_name desc limit 10 offset 15 which shows the 10 rows but from the end of the table.

    what shall be done to get the same result for asc and desc.
    please any body can provide the query for the same.
    with regards.
    Maybe like that
    Code:
    select  *  from (select * from tbl_name  order by column_name asc limit 10 offset 15) t order by column_name desc;
    Does it work?

    Comment

    Working...