left join用法

来源:互联网 发布:入门编程书籍推荐 编辑:程序博客网 时间:2024/05/22 09:43
select t,CONCAT(CURDATE(),' ',t,'点') as showdate, COALESCE(showup,0)  as showup, COALESCE(hit,0)  as hit,COALESCE(hit/showup*100,0) as rt from wifi_hours a left JOIN (select thour, sum(showup)as showup,sum(hit) as hit from (select FROM_UNIXTIME(add_time,"%H") as thour,showup ,hit from wifi_adcount where add_date= '2015-06-03' and mode= 1 and shopid= 1 )  a group by thour )  c on a.t=c.thour;


0 0