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

Hi,
First thing you cannot use " ROWNUM > (somthing) "
And to get last three records...

Select *from emp
minus
Select *from emp where rownum <(select Count(*) from emp)-
3;

Good Luck...

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I run a sql query in pgadmin 4?

999


explain the difference between myisam static and myisam dynamic. : Sql dba

988


How to display Row Number with Records in Oracle SQL Plus?

1094


What is sql analyzer?

1059


What is snowflake sql?

1127


Is it important to partition hard disk?

1068


what is a field in a database ? : Sql dba

1096


How to fetch alternate records from a table?

1305


How do I partition a table in sql?

1206


Can we create table inside stored procedure?

1013


what are string data types? : Sql dba

1093


Does sql use python?

1095


how to write date and time literals? : Sql dba

1010


What is the difference between joins?

1094


what does it mean to have quoted_identifier on? : Sql dba

1181