By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,515 Members | 1,339 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,515 IT Pros & Developers. It's quick & easy.

offset, limit problem

P: 53
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.
Apr 21 '08 #1
Share this Question
Share on Google+
1 Reply


Expert 100+
P: 700
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
Expand|Select|Wrap|Line Numbers
  1. select  *  from (select * from tbl_name  order by column_name asc limit 10 offset 15) t order by column_name desc;
  2.  
Does it work?
Apr 21 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.