#这个写法如果用户一天登录多次就会出现重复问题 select date,sum(case when l.date=m.mdate then 1 else 0 end) new from login l join( select user_id,min(date) mdate from login group by user_id )m on m.user_id=l.user_id #and l.date=m.mdate group by date #所以将then后面的内容改为user_id和null后,在前面加上distinct可以进行去重避免重复问题 select date,count(d...