Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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 do you break a loop in pl sql?

1101


Define union, minus, union all, intersect ?

1064


What is left join example?

1007


What is the difference between a procedure and a function?

1211


Write a query to find the names of users that begin with "um" in sql?

1043


What are the commands used in sql?

1130


Does sql*plus have a pl/sql engine?

1125


How do you copy a table in sql?

1109


What are stuff and replace function?

1141


How to generate a salary slip like jan 1000 1000 feb 1000 2000 ... dec 1000 12000

2205


How do I truncate a word?

1158


What are the differences between in and exists clause?

1164


Why do we need databases?

1085


What is an escape character in sql?

1070


What is a composite primary key?

1142