Dreams.:group by user_id了不是就只能select user_id吗,就像第三题一样,为什么这里能直接select min(date)和count(*)呢
0 点赞 评论 收藏
分享
0 点赞 评论 收藏
分享
牛客933519228号:SELECT date, ifnull( round( (sum (case when (user_id, date) in ( select user_id, date_add(date,interval -1 day) from login group by user_id ) and (user_id,date) in (select user_id,min(date)from login group by user_id) then 1 else 0 end) ) / (sum (case when (user_id,date)in (select user_id,min(date)from login group by user_id) then 1 else 0 end) ) ,3) ,0)as p from login group by date order by date
0 点赞 评论 收藏
分享
关注他的用户也关注了: