This query will fetch you last N rows from the table--
select * from emp where empno not in (select top ( (select count(*) from emp) - 'N') empno from emp ) or
If you are using ORACLE SQL then the query for the same question is
--
select * from ( select rownum as rank,empno,sal
from emp ) where rank>((select max(rownum) from emp)-'N');
select * from emp where empno not in (select top ( (select count(*) from emp) - 'N') empno from emp ) or
If you are using ORACLE SQL then the query for the same question is
--
select * from ( select rownum as rank,empno,sal
from emp ) where rank>((select max(rownum) from emp)-'N');
Comments
Post a Comment