我创建了一个查询,通过使用此查询
对ISO周的生产数据进行分组SELECT to_char(wid_date,'IYYY'), to_char(wid_date,'IW'), tonnes
FROM production
WHERE to_char(wid_date,'IYYY') = '2009'
GROUP BY to_char(wid_date,'IYYY'), to_char(wid_date,'IW')
问题是我们的“生产周”不符合ISO标准。他们从周一早上07:00:00到周一早上06:59:59。
有关如何使用我们的制作周报告的建议吗?
谢天谢地,
托米
答案 0 :(得分:6)
SELECT to_char(wid_date - 7/24,'IYYY'), to_char(wid_date - 7/24,'IW'), tonnes
FROM production
WHERE to_char(wid_date - 7/24,'IYYY') = '2009'
GROUP BY to_char(wid_date - 7/24,'IYYY'), to_char(wid_date - 7/24,'IW')