我在7个工作日的第7天(星期六)让我的日期部分工作时遇到了麻烦。它将在周一至周五返回正确的结果。有什么建议?
SELECT
u.username AS poweruploader,
u.profile_uploads_count AS uploads,
COUNT (CASE WHEN datepart(weekday,i.submission::date) = 1 THEN 1 ELSE NULL END) AS sunday,
COUNT (CASE WHEN datepart(weekday,i.submission::date) = 2 THEN 1 ELSE NULL END) AS monday,
COUNT (CASE WHEN datepart(weekday,i.submission::date) = 3 THEN 1 ELSE NULL END) AS tuesday,
COUNT (CASE WHEN datepart(weekday,i.submission::date) = 4 THEN 1 ELSE NULL END) AS wednesday,
COUNT (CASE WHEN datepart(weekday,i.submission::date) = 5 THEN 1 ELSE NULL END) AS thursday,
COUNT (CASE WHEN datepart(weekday,i.submission::date) = 6 THEN 1 ELSE NULL END) AS friday,
COUNT (CASE WHEN datepart(weekday,i.submission::date) = 7 THEN 1 ELSE NULL END) AS saturday
FROM application.users AS u
JOIN application.image AS i ON u.username = i.username
WHERE profile_uploads_count >= '5'
GROUP BY 1,2