A user can have many subscriptions, and a subscription belongs to one plan.  The plans table tells us a subscription's cost.  Is the query below the correct one for figuring out the number of subscriptions purchased by a user with an ongoing status and the total revenue brought in each day  between Jan 1 and Mar 4, 2016? Essentially, I'm creating a business report via SQL.  Each day bucket should contain the number of ongoing subscriptions created that day and the the total revenue brought in by those subscriptions that day.select    extract(MONTH from subscriptions.created_at) as mth,    extract(DAY from subscriptions.created_at) as dy,    count(subscriptions.id) as subs,    round(sum(plans.cost)::numeric, 2) as revenuefrom usersJOIN subscriptions ON subscriptions.user_id = users.idJOIN plans ON subscriptions.plan_id = plans.idwhere subscriptions.subscription_status = 'ongoing'and subscriptions.created_at >= '01/01/16'and subscriptions.created_at <= '03/04/16'group by MTH, DY order by MTH, DY
SQL report of subscribers and their associated revenue
sql;datetime;postgresql;join