Last active
December 23, 2015 11:29
-
-
Save beck03076/edf1a8bb3da516c0e9cd 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 DISTINCT COUNT(DISTINCT `products`.`id`) | |
FROM `products` | |
WHERE (moderation_status in ('QUEUED','QUEUED_AFTER_APPROVAL','QUEUED_AFTER_REJECT','PROMOTED') | |
OR treasureProduct.products.id in (NULL)) | |
/*=====================*/ | |
SELECT COUNT(DISTINCT u.id) AS Listers,COUNT(p.id)AS Listings | |
FROM accounts.users u | |
LEFT JOIN | |
treasureProduct.products p | |
ON | |
u.id=p.user_id | |
WHERE | |
u.status='verified' | |
AND | |
p.status='active' | |
AND | |
p.created_at < TIMESTAMP(SYSDATE()); | |
/*=====================*/ | |
SELECT p.source as source, COUNT(p.id)AS Listings | |
FROM accounts.users u | |
LEFT JOIN treasureProduct.products p | |
ON u.id=p.user_id | |
WHERE u.status='verified' | |
AND p.status='active' | |
AND p.created_at BETWEEN TIMESTAMP(CURDATE()) | |
AND TIMESTAMP(SYSDATE()) | |
GROUP BY 1\G |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment