"Rubens Jr." <[EMAIL PROTECTED]> writes:

> Create Table test (ID integer primary key, log text);
>
> After inserting some records how can I maintain only
> the last 10 records ?
> Note that ID may have 'roles', that some records may
> be deleted.

Something like this should do it:

  DELETE FROM test
    WHERE ID <=
      (SELECT ID
         FROM test
         ORDER BY ID DESC
         LIMIT 1
         OFFSET 10);

Derrell

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to