[thelist] SQL: Deleting every row over 30

Anthony Baratta Anthony at Baratta.com
Mon Mar 11 15:36:00 CST 2002


At 01:24 PM 3/11/2002, Lauri Vain wrote:
>Hi there,
>
>We're doing a classified system and for each item category we have, what
>the project manager calls "discussion pages". It basically operates in a
>simple 'guestbook style' with the exception that only 30 newest posts
>will be kept in the database (for each category). Older posts will be
>deleted altogether.

Try this approach

Delete from as_discussion where id < (Max(id) - 30)

--
Anthony Baratta
President
Keyboard Jockeys

"Conformity is the refuge of the unimaginative."




More information about the thelist mailing list