Deleting 100 rows which meets certain criteria

Поиск
Список
Период
Сортировка
От shulkae
Тема Deleting 100 rows which meets certain criteria
Дата
Msg-id 1edeb9e0-d8d4-45bc-9794-cba6d6891e14@j24g2000yqa.googlegroups.com
обсуждение исходный текст
Ответы Re: Deleting 100 rows which meets certain criteria  (APseudoUtopia <apseudoutopia@gmail.com>)
Re: Deleting 100 rows which meets certain criteria  (Andreas Kretschmer <akretschmer@spamfence.net>)
Re: Deleting 100 rows which meets certain criteria  (Greg Smith <greg@2ndquadrant.com>)
Re: Deleting 100 rows which meets certain criteria  (Reece Hart <reece@harts.net>)
Список pgsql-general
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

В списке pgsql-general по дате отправления:

Предыдущее
От: Gastón Quiroga
Дата:
Сообщение: Re: pg_dump ERROR, usename "postgres" duplicated
Следующее
От: svcntk
Дата:
Сообщение: Re: esql vs libpq