Skip to content Skip to sidebar Skip to footer

How Can I Select 10th, 20th, 30th ... Row Of The Result Of Another Select Query

I have a table with a column to, from and ID. I need to select only rows with every 10th ID which is from A to B.

Solution 1:

select*from 
(select*fromtablewherefrom='A'andto='B'orderby ID)
wheremod(rownum/10,1) =0

It first takes only those from 'A' to 'B', then giving them rownums, and selecting only those in the 10th 20th ETC places..

Solution 2:

Or you can just use

selectfrom, to, id 
from table1 
where id like'%0'andfrom='A'andto='B'

Post a Comment for "How Can I Select 10th, 20th, 30th ... Row Of The Result Of Another Select Query"