0

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

select *
from employee;
APC
  • 144,005
  • 19
  • 170
  • 281
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
  • 6,330
  • 2
  • 21
  • 30
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
  • 54,457
  • 9
  • 76
  • 110
Nandan Chaturvedi
  • 1,028
  • 3
  • 16
  • 32
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
  • 131,892
  • 15
  • 35
  • 57