-- 最近2个自然周统计:
SELECT count(CASE WHEN (int(datediff(scheduled_date,'2001-01-01')/7)
IN (int(datediff(CURRENT_DATE,'2001-01-01')/7)-2,int(datediff(CURRENT_DATE,'2001-01-01')/7)-1)
AND class_status='FINISHED' AND finish_type='AS_SCHEDULED') THEN scheduled_date END) AS last_2week__cnt
FROM xxx.xxx
sql自然周统计
最新推荐文章于 2024-09-19 18:25:15 发布