更新 '2.4.cpp'
This commit is contained in:
parent
4b0eed8e40
commit
37b51e3775
21
2.4.cpp
21
2.4.cpp
|
@ -64,6 +64,27 @@ int main()
|
|||
});
|
||||
});
|
||||
|
||||
conn.exec("use bigdata2",nullptr);
|
||||
conn.exec("select job_city,count(*) from (select job_city from pages group by company_name) as B group by job_city",
|
||||
[&](MySQLResult& res)
|
||||
{
|
||||
res.stepRow([&](char** val,unsigned long* len)
|
||||
{
|
||||
string city(val[0]);
|
||||
int cnt=ParseInt(val[1]);
|
||||
|
||||
auto iter=mp.find(city);
|
||||
if(iter!=mp.end())
|
||||
{
|
||||
iter->second += cnt;
|
||||
}
|
||||
else
|
||||
{
|
||||
mp.insert(make_pair(city,cnt));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
for(auto iter=mp.begin();iter!=mp.end(); )
|
||||
{
|
||||
bool updated=false;
|
||||
|
|
Reference in New Issue
Block a user