
Untitled
By: a guest on
May 2nd, 2012 | syntax:
None | size: 0.49 KB | hits: 21 | expires: Never
SELECT
t.seller_user_id AS seller_id,
us.creation_tsz AS signup_date,
SUM(t.price*t.quantity) as GMS,
subpath(t.tags, 0, 1) AS category
FROM
etsy_v2.transactions t JOIN
etsy_v2.users_seller us ON t.seller_user_id=us.user_seller_id
WHERE
EXTRACT(YEAR FROM us.creation_tsz = '2008' AND
EXTRACT(MONTH FROM us.creation_tsz) = '05' AND
t.creation_tsz >= '2010-05-01' AND t.creation_tsz < '2010-05-31' AND
t.tags ~ 'jewelry.*'
GROUP BY 1
ORDER BY GMS DESC, signup_date, category
;