sql >> Database >  >> RDS >> Mysql

mysql gebruikersaanmelding telt tussen groepen

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


  1. Ebean handmatige decodering

  2. Het selecteren van willekeurige vragen uit de MySQL-database; juiste antwoord verknald

  3. 2 manieren om alle triggers in een PostgreSQL-database op te sommen

  4. Wanneer MyISAM en InnoDB gebruiken?