Commit 6d0a38f5 authored by 高雅喆's avatar 高雅喆

add a label in sql union statement at getClickZeroUidRateDetail.py

parent 6cb6342a
......@@ -28,7 +28,7 @@ def get_rate_detail(platform):
platform = " is not null"
db = pymysql.connect(host='10.66.157.22', port=4000, user='root', passwd='3SYz54LS9#^9sBvC', db='jerry_test')
cursor = db.cursor()
sql = "select count(distinct(device_id)) from data_feed_exposure \
sql = "select '0-7' as label,count(distinct(device_id)) from data_feed_exposure \
where device_type{0} \
and from_unixtime(time,'%Y-%m-%d')=date_add(curdate(), interval -1 day) \
and device_id not in \
......@@ -42,7 +42,7 @@ def get_rate_detail(platform):
(select distinct(device_id) from data_feed_exposure \
where time < {2})) \
union all \
select count(distinct(device_id)) from data_feed_exposure \
select '7-14' as label,count(distinct(device_id)) from data_feed_exposure \
where device_type{0} \
and from_unixtime(time,'%Y-%m-%d')=date_add(curdate(), interval -1 day) \
and device_id not in \
......@@ -59,7 +59,7 @@ def get_rate_detail(platform):
(select distinct(device_id) from data_feed_exposure \
where time < {2})) \
union all \
select count(distinct(device_id)) from data_feed_exposure \
select '14-30' as label,count(distinct(device_id)) from data_feed_exposure \
where device_type{0} \
and from_unixtime(time,'%Y-%m-%d')=date_add(curdate(), interval -1 day) \
and device_id not in \
......@@ -76,7 +76,7 @@ def get_rate_detail(platform):
(select distinct(device_id) from data_feed_exposure \
where time < {3})) \
union all \
select count(distinct(device_id)) from data_feed_exposure \
select '30-60' as label,count(distinct(device_id)) from data_feed_exposure \
where device_type{0} \
and from_unixtime(time,'%Y-%m-%d')=date_add(curdate(), interval -1 day) \
and device_id not in \
......@@ -93,7 +93,7 @@ def get_rate_detail(platform):
(select distinct(device_id) from data_feed_exposure \
where time < {4})) \
union all \
select count(distinct(device_id)) from data_feed_exposure \
select '60-90' as label,count(distinct(device_id)) from data_feed_exposure \
where device_type{0} \
and from_unixtime(time,'%Y-%m-%d')=date_add(curdate(), interval -1 day) \
and device_id not in \
......@@ -110,7 +110,7 @@ def get_rate_detail(platform):
(select distinct(device_id) from data_feed_exposure \
where time < {5})) \
union all \
select count(distinct(device_id)) from data_feed_exposure \
select '90+' as label,count(distinct(device_id)) from data_feed_exposure \
where device_type{0} \
and from_unixtime(time,'%Y-%m-%d')=date_add(curdate(), interval -1 day) \
and device_id not in \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment