try this:

UPDATE dbmail_messages SET status = 2 WHERE physmessage_id IN (select id from dbmail_physmessage, dbmail_mailboxes WHERE dbmail_physmessage.internal_date < 'NOW - 30 days' AND dbmail_mailboxes.name="spam";)


Michael Luich
Aleksander Kamenik wrote:
Hi,

This is actually more of a SQL question than dbmail. I'm not really familiar with SQL, so I'm asking for help here, as this might interest some other dbmail admins.

In my setup every user has a mailbox named "spam" which contains as you've guessed it -- spam.

Some users don't clean up their spam boxes at all, some don't do it frequently.

So I need to construct some wild JOIN which would do something like this:

UPDATE dbmail_messages SET status="2"
WHERE dbmail_physmessage.internal_date < 'NOW - 30 days'
AND dbmail_mailboxes.name="spam"

Please help with creating this query.

Using mysql 5.0.x.

Kind regards,




This email and any files transmitted with it are confidential and intended 
solely for the individual(s) or entity to whom they are addressed.

If you have received this email in error please notify the originator of the 
message.

Any views expressed in this message are those of the individual sender.

This message has been scanned for Content, viruses and spam by GlobalCerts  
RiskFilter - E-mail.
www.GlobalCerts.net



This email and any files transmitted with it are confidential and intended 
solely for the individual(s) or entity to whom they are addressed.

If you have received this email in error please notify the originator of the 
message.

Any views expressed in this message are those of the individual sender.

This message has been scanned for Content, viruses and spam by GlobalCerts  
RiskFilter - E-mail.
www.GlobalCerts.net

_______________________________________________
DBmail mailing list
[email protected]
https://mailman.fastxs.nl/mailman/listinfo/dbmail

Reply via email to