CHECK DQ Issue in Slowly Changing Dimension

SEL begin_date, COUNT(1)
FROM
(
SEL
user_id
, begin_date
, end_date
, MAX(begin_date) OVER (PARTITION BY user_id ORDER BY begin_date, end_date ROWS BETWEEN 1 FOLLOWING AND 1 FOLLOWING) AS next_begin_date
 FROM SLOWLY_CHANGING_DIMENSION
 ) t
WHERE t.next_begin_date IS NOT NULL AND t.next_begin_date <= t.end_date
GROUP BY 1
ORDERY BY 1
;

你可能感兴趣的:(Date,user,null)