Skip to content

Instantly share code, notes, and snippets.

@leafo
Last active December 30, 2015 05:09
Show Gist options
  • Save leafo/7780535 to your computer and use it in GitHub Desktop.
Save leafo/7780535 to your computer and use it in GitHub Desktop.
select sum(count) from downloads_daily where date >= '2013-12-01' and date < '2014-1-1';
6852
select count(*) from games where published and not deleted and created_at >= '2013-12-01' and created_at < '2014-1-1';
170
select count(*) from purchases where status = 1 and created_at >= '2013-12-01' and created_at < '2014-1-1';
1403
select (sum(price)/100.0)::money from purchases where status = 1 and created_at >= '2013-12-01' and created_at < '2014-1-1';
$6,526.24
select (sum(purchases.price - games.min_price)/100.0)::money from purchases inner join games on purchases.game_id = games.id where purchases.status = 1 and purchases.price > games.min_price and purchases.created_at >= '2013-12-01' and purchases.created_at < '2014-1-01';
$1,979.08
select count(*) from purchases inner join games on purchases.game_id = games.id where purchases.status = 1 and purchases.price > games.min_price and purchases.created_at >= '2013-12-01' and purchases.created_at < '2014-1-01';
451
select (avg(purchases.price - games.min_price)/100.0)::money from purchases inner join games on purchases.game_id = games.id where purchases.status = 1 and purchases.price >= games.min_price and purchases.created_at >= '2013-12-1' and purchases.created_at < '2014-1-1
$2.09
-- January
select sum(count) from downloads_daily where date >= '2014-1-01' and date < '2014-2-1';
17646
select count(*) from games where published and not deleted and created_at >= '2014-1-1' and created_at < '2014-2-1';
376
select count(*) from purchases where status = 1 and created_at >= '2014-1-1' and created_at < '2014-2-1';
2053
select (sum(price)/100.0)::money from purchases where status = 1 and created_at >= '2014-1-01' and created_at < '2014-2-1';
$10,497.75
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment