I have this query..
SELECT DATE_FORMAT(utcdt,GET_FORMAT(DATE,'ISO')) as utcdt,
HOUR(utcdt) as hour,
country,
sum(impressions) as impressions
FROM rtb_impressions where campaign_id='cid2204184260'
GROUP BY utcdt, hour, country
These are the results…..
{'impressions': Decimal('1'), 'country': 'US', 'hour': 10L, 'utcdt': '2012-10-01'}
{'impressions': Decimal('40000'), 'country': 'US', 'hour': 9L, 'utcdt': '2012-10-02'}
{'impressions': Decimal('20000'), 'country': 'US', 'hour': 9L, 'utcdt': '2012-10-02'}
Why did I get three rows when I should have gotten 2? 012-10-02 should have been summed.
Thanks
You are getting that because you are grouping by the wrong value.
Try this instead: