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 / gnreddy

try this one.
select * from emp where 3 >( select count(1) from emp e where e.rowid > emp.rowid);

Is This Answer Correct ?    7 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How is debugging done?

723


How we can update the view?

813


Is full outer join same as cross join?

695


What is left join example?

677


Why is nosql good?

777






What is rank dense_rank and partition in sql?

752


How many types of indexes are there in sql?

719


What is linq to sql?

772


How does cross join work?

655


What is the difference between partition and index?

658


What is a database trigger?

791


What is the use of function "module procedure" in pl/sql?

884


How do you sort in sql?

774


Why is stored procedure faster than query?

701


what is collation? : Sql dba

799