wat will be the sql query to extract only last 3 records
from table supose table hving thousands for records

Answer Posted / amit kaishver

Select * from ( select rownum k,g.* from nbfc_bank_m g) h,
(select max(rownum) a,max(rownum)-1 b,max(rownum)-2 c
from nbfc_bank_m ) p
where h.k in (p.a,p.b,p.c)

Is This Answer Correct ?    5 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is filter index?

698


What are the 3 types of schema?

780


Determine how to use the inserted and deleted pseudo tables?

725


What does COMMIT command do?

768


How can I create a new template for import ? : sql server management studio

790






Where is localdb stored?

729


What is the difference between ‘having’ clause and a ‘where’ clause?

768


What are the types of indexes?

768


Can group by be used without aggregate functions?

672


How can a database be repaired?

724


Explain transaction server consistency?

686


If user is owning any SQL Objects, can we drop that user

1807


Explain what are the database objects? : SQL Server Architecture

753


Write a SQL query to delete a table?

844


What is openxml in sql server?

877