I have a data of users playing multiple games for 6 months
I have Table name: App_Click
Column Names: - user_id , date ( the date user clicked on game),
app_name ,
App_click ( Total Number of Clicks by each user)
if the entry exists than the user have clicked on the app(ie played)
Question: I'm looking for the unique users who play the game ABC every week at least 2 or more times in 30 days or Quarterly
Looking Solution like: Total users Who played ABC: 100 ( users who have played other games also)
Total users Who have played only ABC: 30 ( only users who plays only ABC)
Total users Who have played ABC and other games: 70 ( users who playes other games with ABC)
You can use two levels of aggregation:
select countif(num_abc > 0) as num_abc_users,
countif(num_abc > 0 and num_other = 0) as num_abc_only,
countif(num_abc > 0 and num_other > 0) as num_abc_plus_other
from (select user_id, countif(app_name = 'ABC') as num_abc, countif(app_name <> 'ABC') then num_other
from t
group by user_id
) t;
The subquery summarizes for each user. The outer then aggregates those results.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.