Commit e4e848a9 authored by 张彦钊's avatar 张彦钊

change sql

parent 18032158
...@@ -45,8 +45,9 @@ def get_eachCityDiaryTop2000(): ...@@ -45,8 +45,9 @@ def get_eachCityDiaryTop2000():
cityList = get_cityList() cityList = get_cityList()
allCitiesTop2000 = get_allCitiesDiaryTop2000() allCitiesTop2000 = get_allCitiesDiaryTop2000()
for i in cityList: for i in cityList:
sql = "select '{0}',cid from data_feed_click " \ sql = "select city_id,cid from data_feed_click " \
"where cid_type = 'diary' group by cid order by max(click_count_choice) desc limit 2000".format(i) "where cid_type = 'diary' and city_id = '{0}' group by cid " \
"order by max(click_count_choice) desc limit 2000".format(i)
data = con_sql(sql) data = con_sql(sql)
data = data.rename(columns={0: "city_id", 1: "cid"}) data = data.rename(columns={0: "city_id", 1: "cid"})
data = filter_cid(data) data = filter_cid(data)
......
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