How to get 1,4,7,10.....rows from a table

Showing Answers 1 - 5 of 5 Answers

rajesh

  • Sep 14th, 2005
 

 select * from yet where (rowid,1) in (select rowid, mod(rownum,3)from yet);

venkat

  • Oct 3rd, 2005
 

rajesh Wrote:  select * from yet where (rowid,1) in (select rowid, mod(rownum,3)from yet);

  Was this answer useful?  Yes

aish

  • Mar 6th, 2006
 

 

Assume Test table with following values

     COL1
----------
         1
         2
         5
         6
         1
         8
         4
        12

Using inline views,

select a.rr,a.col1
from (select rownum rr,mod(rownum,3) rn,col1 from test) a
where a.rn=1

output

        RR       COL1
---------- ----------
         1          1
         4          6
         7          4

ganne

  • Aug 2nd, 2006
 

select rownum,empno from emp group by rownum,empno having mod(rownum,3)=1;

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions