色婷婷狠狠18禁久久YY,CHINESE性内射高清国产,国产女人18毛片水真多1,国产AV在线观看

sql語句如何查詢指定日期共幾天

sql語句如何查詢指定日期共幾天?

CREATE TABLE #tempzhihu1

(UID BIGINT,

LOADTIME DATETIME)

INSERT INTO #tempzhihu1

VALUES

(201,'2017/1/1'),

(201,'2017/1/2'),

(202,'2017/1/2'),

(202,'2017/1/3'),

(203,'2017/1/3'),

(201,'2017/1/4'),

(202,'2017/1/4'),

(201,'2017/1/5'),

(202,'2017/1/5'),

(201,'2017/1/6'),

(203,'2017/1/6'),

(203,'2017/1/7')

SELECT UID, MAX(DAYS) AS ConsecutiveDays

FROM(

SELECT UID,count(GroupingSet) AS DAYS

FROM

(SELECT UID, LOADTIME,

GroupingSet = DATEADD(DAY,-ROW_NUMBER() OVER(PARTITION BY UID ORDER BY LOADTIME), LOADTIME)

FROM #tempzhihu1) T1

GROUP BY UID,GroupingSet) T2

GROUP BY UID

DROP TABLE #tempzhihu1

sqlload java,sql語句如何查詢指定日期共幾天