Last active
September 15, 2016 09:18
-
-
Save micw/1de4100c66b9d37d9c7df4a9fb55474b to your computer and use it in GitHub Desktop.
SQL statement to update customer's email usage after manual changes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| update panel_customers set | |
| email_accounts_used=(select count(*) from mail_users where mail_users.customerid=panel_customers.customerid), | |
| emails_used=(select count(*) from mail_virtual where mail_virtual.customerid=panel_customers.customerid), | |
| email_quota_used=(select sum(quota) from mail_users where mail_users.customerid=panel_customers.customerid), | |
| email_forwarders_used=(select sum(CHAR_LENGTH(replace(destination,email_full,''))-CHAR_LENGTH(replace(replace(destination,email_full,''),'@',''))) from mail_virtual where mail_virtual.customerid=panel_customers.customerid); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment