Hi Paul,

> You can't do this in one query (at least not on mysql).
> 
> You'll need to fetch a list of message_idnr to delete (1) and then
> delete the messages (2).
> 
> 1)
> select message_idnr from dbmail_messages m
>   join dbmail_physmessage p on m.physmessage_id=p.id
>   join dbmail_mailboxes b on m.mailbox_idnr=b.mailbox_idnr
>   join dbmail_users u on b.owner_idnr=u.user_idnr
> where
>    userid='testuser1' and
>    b.name='INBOX' and
>    p.internal_date < '2011-01-01';
> 
> 2)
> delete from dbmail_messages where message_idnr in (xxx);
> 

I'm testing dbmail-export, I think I'll go for that solution, what do you
say? It's better than messing with the database, no?

_______________________________________________
Dbmail-dev mailing list
Dbmail-dev@dbmail.org
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail-dev

Reply via email to