Created
April 18, 2013 02:53
-
-
Save breandan/5409660 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 * 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