0

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

select *
from employee;
APC
  • 141,155
  • 19
  • 165
  • 275
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,847
  • 2
  • 16
  • 25
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
  • 46,769
  • 7
  • 65
  • 91
Nandan Chaturvedi
  • 1,010
  • 2
  • 15
  • 31
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
  • 107,599
  • 14
  • 32
  • 52