Skip to content

Instantly share code, notes, and snippets.

@heathdutton
Last active October 5, 2018 14:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save heathdutton/bab518e0ab46485d9b9eb1af66731697 to your computer and use it in GitHub Desktop.
Save heathdutton/bab518e0ab46485d9b9eb1af66731697 to your computer and use it in GitHub Desktop.
Find unpublished categories in Mautic that have published campaigns under them. Because these categories are unpublished all campaigns under them will be paused.
SELECT cat.id as category_id, cat.title as category_name, COUNT(camp.id) as campaigns
FROM campaigns camp
LEFT JOIN categories cat
ON camp.category_id = cat.id
WHERE
cat.is_published = 0
AND camp.is_published = 1
GROUP BY cat.id;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment