0

I have to limit to 2 rows. But can't do it for a SQL-Fetch.

select *
from employee;
APC
  • 137,061
  • 19
  • 153
  • 266
Talha
  • 11
  • 2

3 Answers3

1

You can use something like this:

 select *
 from  
 ( select * 
 from emp 
 order by data desc ) 
 where ROWNUM <= 2;
Gauravsa
  • 5,551
  • 1
  • 13
  • 23
0

You can change the query as:

select *
from
  top_n_test
order by
  num
fetch first 3 rows only;

The select first n rows only selects the first n rows.

Wernfried Domscheit
  • 38,841
  • 5
  • 50
  • 81
Nandan Chaturvedi
  • 980
  • 2
  • 11
  • 30
0

Well, the simplest way is to

select * 
from employee
where rownum <= 2;

but the question is what exactly do you want to do with that.

Littlefoot
  • 78,293
  • 10
  • 26
  • 46