题目
有如下一张表G0817
如何查询各个用户最长的连续登陆天数?
预计结果如下:
测试数据
CREATE TABLE G0817 (
UID VARCHAR(10),
LOADTIME DATE
)
INSERT INTO G0817 SELECT '201','2017/01/28' UNION ALL
SELECT '201','2017/01/29' UNION ALL
SELECT '202','2017/01/29' UNION ALL
SELECT '202','2017/01/30' UNION ALL
SELECT '203','2017/01/30' UNION ALL
SELECT '201','2017/01/31' UNION ALL
SELECT '202','2017/01/31' UNION ALL
SELECT '201','2017/02/01' UNION ALL
SELECT '202','2017/02/01' UNION ALL
SELECT '201','2017/02/02' UNION ALL
SELECT '203','2017/02/02' UNION ALL
SELECT '203','2017/02/03'
参考答案