Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search archives
  Advanced Search

Deleting 100 rows which meets certain criteria



I am newbie to postgres/SQL.

I want to delete all rows exceeding 400 hours (10 days) and I want to
limit deletion of only 100 records at a time.

I was trying the following in PostgreSQL:

DELETE from mytable WHERE (now() - timestamp_field  > INTERVAL '400
hour' ) LIMIT 100;

Looks like DELETE syntax doesn't support LIMIT.

Is there any other way to achieve this?

thanks
Shul



Home | Main Index | Thread Index

Privacy Policy | About PostgreSQL
Copyright © 1996 – 2012 PostgreSQL Global Development Group