Skip to content

Instantly share code, notes, and snippets.

@breandan
Created April 18, 2013 02:53
Show Gist options
  • Save breandan/5409660 to your computer and use it in GitHub Desktop.
Save breandan/5409660 to your computer and use it in GitHub Desktop.
select * from
(select anreports.hour,
anreports.our_internal_media_cost,
sum(anbidder_reservations.actual_spend),
sum(anbidder_reservations.actual_spend)/anreports.our_internal_media_cost as error
from
(select hour(start_time) as hour,
date(start_time) as date,
sum(our_media_cost) as our_internal_media_cost
from amplifyprod.bidder_report_aggregates
where destination_group_id = 430 and start_time
like '2013-04-18%' group by hour(start_time)) as anreports
join amplifyprod.anbidder_reservations
on hour(anbidder_reservations.reserved_at) = anreports.hour
and anbidder_reservations.destination_group_id = 430
where date(actual_spend_time) = date(anreports.date)
group by anreports.hour) as test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment