For example this SQL statement returns 1k rows
SELECT * FROM tableName WHERE someCondition
my question is: is it possible by using WHERE
1) Split Resultset to the 10 partial resultsets, then
1st. would be returns 0% – 10%,
2nd. 10% – 20%,
etc..
2) cuts range between 50 – 150th rows
Advertisement
Answer
If you are using oracle database this is very simple.
you can use ROWNUM keyword to achive this task in following manner..
select * from ( select tb.*,rownum t_count from table_name tb ) ss where ss.t_count >= @min_value and ss.t_count <= @max_value
where @min_value and @max_value is the range for what you want to get data… actually it will work on concept of inner query and temprory tables.
that’s why it will give good performance over fatching all the data in one shot.