Mysql
 sql >> Base de données >  >> RDS >> Mysql

L'inscription de l'utilisateur mysql compte entre les groupes

select date, SUM(case when subscriber = 1 and s2member_level2 = 0 then 1 else 0 end) subscriber,
           SUM(case when s2member_level2 = 1 then 1 else 0 end) s2member_level2
from
(   select  date(user_registered) date,
             id,
            sum(case when B.meta_key = "wp_capabilities" then 1 else 0 end) as subscriber,
            sum(case when B.meta_key = "wp_s2member_subscr_id" then 1 else 0 end) as s2member_level2
    from wp_users A LEFT JOIN wp_usermeta B ON A.Id = B.user_id            
    group by date(user_registered), id
) C
group by date