MySQL Forums
Forum List  »  Oracle

Re: Delete all rows in table but keep the last recent 2
Posted by: Pavel Leonov
Date: September 24, 2009 07:28AM

Hi Yvonne,

You need to order by the CREATE_DATE column and limit 2. This will select only the latest 2 records from the table, like:
select * from tab order by CREATE_DATE desc limit 2;

Kind Regards, Pavel Leonov
Ispirer Systems
www.ispirer.com
SQLWays converts Oracle procedures, triggers, views and tables to MySQL.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Delete all rows in table but keep the last recent 2
5616
September 24, 2009 07:28AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.