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
Explian rowid, rownum? What are the psoducolumns we have?
How can we connect an Android App to an Oracle database and use the PL/SQL procedural code?
How to rename a column in the output of sql query?
Can we insert in view in sql?
What is a .db file?
Can a trigger call a stored procedure?
Does view store data in sql?
how to get a list of indexes of an existing table? : Sql dba
What are the operators used in select statements?
how to increment dates by 1 in mysql? : Sql dba
What is the difference between microsoft access and sql?
What are the events on which a database trigger can be based?
How to look at the current sql*plus system settings?
What are sql commands?
What is an example of translating a date into julian format?