how to retrieve last tree records from table?
select *from emp where rownum > (select count(*)-3 from
emp);
i am using this query to get last three records from table
but its not giving any output, so please tell me what is the
error in this query.
Answer Posted / bikash khuntia
select * from (
select rownum rw,bk.sal from
(select sal from TEMP_SAL order by rowid desc) bk) bik
where bik.rw<=3
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
what is the difference between undefined value and null value? : Sql dba
What is procedure and function in sql?
Why use stored procedures?
Is it possible to remove child records without removing master table records...the two having pk,fk relationship?
what are set operators in sql? : Sql dba
how to include comments in sql statements? : Sql dba
how to create a test table in your mysql server? : Sql dba
What's the difference between inner join and left join?
What is record data type?
Can we rollback after truncate?
what are the differences between public, private, protected, static, transient, final and volatile? : Sql dba
Why functions are used in sql?
What action do you have to perform before retrieving data from the next result set of a stored procedure ?
What does inner join mean?
How to display the current date in sql?