SELECT gender, data_date, count(*) as showCount
FROM user_agg left join user_info on user_agg.uid = user_info.uid
where event_id = 'show'
group by gender, data_date
大佬厉害,问题解决了,学习了
select t1.uid,(case t2.gender when 2 then '女' when 1 then '男' END) as gender,t1.data_date,Count(t1.event_id)as num from user_agg t1,user_info t2 where
t1.uid=t2.uid
and t1.event_id='show' group BY t2.gender,data_date
我参考上面那个大佬的答案,不过也谢谢你,都是大佬,谢谢
@leafyin: 我这样写 只是让你更容易看懂
@码上有钱(why): 好嘞,谢谢哥
分组啊
– 码上有钱(why) 9个月前@码上有钱(why):order by 哪个字段呢,我感觉性别也需要分组,日期是不是也要分组,一条查询好想还不能满足
– leafyin 9个月前