Last active
January 9, 2019 11:30
-
-
Save agarzon/d8634fda108c7a4c5a1c to your computer and use it in GitHub Desktop.
Generate report with all domains by client and plan (plesk)
This file contains 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
SELECT domains.name as domain, Templates.name as plan, domains.status, clients.type, clients.login, clients.pname, clients.email, clients.external_id, Subscriptions.locked, Subscriptions.synchronized, Subscriptions.custom | |
FROM domains | |
LEFT JOIN clients ON domains.cl_id = clients.id | |
LEFT JOIN Subscriptions ON domains.id = Subscriptions.object_id AND Subscriptions.object_type = 'domain' | |
LEFT JOIN PlansSubscriptions ON Subscriptions.id = PlansSubscriptions.subscription_id | |
LEFT JOIN Templates ON PlansSubscriptions.plan_id = Templates.id | |
WHERE clients.type = 'client' | |
AND clients.parent_id = '1' | |
AND domains.parentDomainId = '0' | |
INTO OUTFILE '/tmp/domains-client.csv'; | |
# Reseller | |
SELECT Templates.name as plan, clients.status, clients.type, clients.login, clients.pname, clients.email, clients.external_id, Subscriptions.locked, Subscriptions.synchronized, Subscriptions.custom | |
FROM `clients` | |
LEFT JOIN Subscriptions ON clients.id = Subscriptions.object_id AND Subscriptions.object_type = 'client' | |
LEFT JOIN PlansSubscriptions ON Subscriptions.id = PlansSubscriptions.subscription_id | |
LEFT JOIN Templates ON PlansSubscriptions.plan_id = Templates.id | |
WHERE clients.type = 'reseller' | |
INTO OUTFILE '/tmp/reseller-client.csv'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment