1,原始表结构
2,按日期查询出每天 采集的不同类型的url的个数:并且类型为空的也要查询。
SELECT date_format(ssdate,'%Y年%m月%d日') as day, sum(case leixing when 1 then 1 else 0 end )'相关', sum(case leixing when 2 then 1 else 0 end )'bu相关',
sum(case leixing when 1 then 0 when 2 then 0 else 1 end )'bubu相关'FROM studysql.new_table group by date_format(ssdate,'%y%m%d');
SELECT date_format(ssdate,'%Y年%m月%d日') as day, sum(case leixing when 1 then 1 else 0 end )'相关', sum(case leixing when 2 then 1 else 0 end )'bu相关',
sum(case leixing when 1 then 0 when 2 then 0 else 1 end )'bubu相关'FROM studysql.new_table group by date_format(ssdate,'%y%m%d');
3,查询结果