bug_x

导航

 

 select gid,count(distinct mid) from members group by gid

 mysql> SELECT   IFNULL(NULL,10);   
 mysql> 10


 select a.gid,a.t_m,ifnull(b.h_c,0) as hc,(a.t_m-ifnull(b.h_c,0)) as l_c from (select mem.gid as gid,count(distinct mid) as t_m from members mem group by gid) as a left join (select gid,count(distinct mid) as h_c from members_history group by gid) as b on a.gid = b.gid;

 

posted on 2018-07-18 15:24  bug_x  阅读(92)  评论(0编辑  收藏  举报