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

How to use user defined functions in expressions?

537


How can sql injection be stopped? : sql server security

530


Does index speed up select statements?

558


How to get a list of columns in a view using the "sp_columns" stored procedure?

594


Does server sql treat char as a variable-length or fixed-length column?

558






What options are available to audit login activity? : sql server security

601


What do you understand by the denormalisation?

517


If a table does not have a unique index, can a cursor be opened on it?

498


Explain about service Broker functions?

599


what is new philosophy for database devises for sql server 7.0? : Sql server database administration

496


What gets stored inside msdb database?

741


How to rename an existing column with the "sp_rename" stored procedure in ms sql server?

534


Explain cross join or cartesian product in sql?

524


What is a data source file?

471


Explain having clause?

507