卖逼视频免费看片|狼人就干网中文字慕|成人av影院导航|人妻少妇精品无码专区二区妖婧|亚洲丝袜视频玖玖|一区二区免费中文|日本高清无码一区|国产91无码小说|国产黄片子视频91sese日韩|免费高清无码成人网站入口

sql連續(xù)登錄5天以上用戶 查連續(xù)5天登陸的用戶,sql怎么寫?

查連續(xù)5天登陸的用戶,sql怎么寫?新增用戶登陸日志表(id、user_id、login_time、login_date)用戶表新增連續(xù)登陸天數(shù)字段(continuous_days);用戶每次登陸往登

查連續(xù)5天登陸的用戶,sql怎么寫?

新增用戶登陸日志表(id、user_id、login_time、login_date)用戶表新增連續(xù)登陸天數(shù)字段(continuous_days);用戶每次登陸往登陸日志表insert記錄,并且查看昨天是否有登陸記錄,如果昨天登陸記錄大于0,則連續(xù)登陸天數(shù) 1,否則將連續(xù)登陸天數(shù)置為0;sql語句:select*fromuserwhere continuous_days>5

SQL語句如何查詢各個用戶最長的連續(xù)登陸天數(shù)?

最簡單的子查詢:select * from table where date = (select max(date) from table)

或者用輪子哥講的join自己:

select * from table t1 left join (select max(date) as date from table) t2 on t1.date=t2.date where t2.date is not null