I don't think it is possible at least not with one query. You can limit the 
numbers of record to delete, but at least until 4.1 there is no offset. 
Probably you can do it with a subselect like this

delete from where to_uid=1 and read_timestamp>0 and timestamp<(select 
timestamp from messages  where to_uid=1 and read_timestamp>0 order by 
timestamp desc limit 100,1)

HTH
-- 
Dobromir Velev
[EMAIL PROTECTED]
http://www.websitepulse.com/

On Friday 21 October 2005 11:44, Eric Persson wrote:
> Hi,
>
> Is it possible to delete from a table with some sort of offset? I did
> the following select query, which selects a message from a message table.
>
> select id, subject from messages where to_uid=1 and read_timestamp>0
> order by timestamp desc limit 3,1;
>
> The reason is I only want it to be 3 messages per to_uid, so id thought
> I would be able to delete from the third message and forward with
> something like.
>
> delete from messages where to_uid=1 and read_timestamp>0 order by
> timestamp desc limit 3,1000;
>
> What I basically want is it to delete all messages above 100 for each
> user, any clues on how to solve this?
>
> Best regards,
>  Eric


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to