renyupeng 8 ماه پیش
والد
کامیت
4f48f2e5af
1فایلهای تغییر یافته به همراه6 افزوده شده و 2 حذف شده
  1. 6 2
      Apietl/kwai_etl/report/CampaignHourlyReport.py

+ 6 - 2
Apietl/kwai_etl/report/CampaignHourlyReport.py

@@ -23,8 +23,12 @@ class CampaignHourlyReport:
 
     def hourly_report(self):
         try:
-            sql = """select advertiser_id from media_api.kuaishou_campaign_report_hourly where 
-            stat_date = {start_time}  and charge>0 group by advertiser_id""".format(
+            sql = """
+            select advertiser_id from (
+            select advertiser_id ,sum(charge) as charge from media_api.kuaishou_campaign_report_hourly where 
+            stat_date = {start_time} group by advertiser_id)t 
+            where charge>0
+            """.format(
                 start_time=self.start_time)
             account_list = TidbConn.quary(self.conn, sql)
             for account_id in account_list: