Last active
August 29, 2015 14:16
-
-
Save warrendholmes/3247acb399183c016745 to your computer and use it in GitHub Desktop.
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
SELECT | |
DATE_FORMAT( date_created, '%Y-%m' ), | |
COUNT( * ) AS 'Licenses Created', | |
SUM( IF( DATE_FORMAT( date_created, '%Y-%m-%d' ) < '2013-08-01', IF( DATE_ADD( date_created, INTERVAL 2 YEAR ) > support_expiry_date, 0, 1 ), IF( DATE_ADD( date_created, INTERVAL 1 YEAR ) > support_expiry_date, 0, 1 ) ) ) as 'Licenses Renewed' | |
FROM license | |
WHERE lifetime <> 1 | |
and product_id not in (18596,18606,18608,18656,18825,56536,56542,56546,56551,56552,56553,56556,56557,56558,56559,56560,56561,56562,56563,56564,120726,120727,120728,120730,120733,120736,120741,120744,120745,120746,120748,120749,120750,120752,120753,120754,120755,120759,124451,131599,135051,138175,142278,143158,168744,170213,176537,185343,190246,190248,196635,197567,201497,202412,204152,213827,222996,225393,226188,234845,238816,239962,244762,290592,291779,312408,312508,435830,435833,435834,474603,475304,489666,491331,493046,497916,502349,524956,536332,543228,565154) | |
GROUP BY DATE_FORMAT( date_created, '%Y-%m' ) | |
ORDER BY DATE_FORMAT( date_created, '%Y-%m' ) DESC | |
//Get product ids in free cat | |
SELECT product_id FROM `product_product_cat_rel` where product_cat_id IN (SELECT id FROM `product_cat` where title = 'Free') group by product_id |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment