成人AV在线无码|婷婷五月激情色,|伊人加勒比二三四区|国产一区激情都市|亚洲AV无码电影|日av韩av无码|天堂在线亚洲Av|无码一区二区影院|成人无码毛片AV|超碰在线看中文字幕

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