这是我的代码:
SELECT DISTINCT
DAY,
county,
CASE WHEN (Date_2 > Date_1) THEN (region) ) then (region)
WHEN (Date_2 = Date_1) THEN MIN(region) Over (Partition By DAY, county)
ELSE region
END AS region,
CASE WHEN (Date_2 > Date_1) THEN handoff_date
WHEN (Date_2 = Date_1) THEN MIN(handoff_date) Over (Partition By DAY, county)
END AS date2,
CASE WHEN (Date_2 = Date_1) THEN MIN(Date_1) Over (Partition By DAY, county)
WHEN (Date_2 > Date_1) THEN (Date_1)
END AS date1,
CASE WHEN (Date_2 = Date_1) THEN MAX(Date_end) Over (Partition By DAY, county)
WHEN (Date_2 > Date_1) THEN (Date_end)
END AS dateEnd
FROM table
GROUP BY 1,2,3,4,5
我正在尝试创建具有上述指定格式的文本文件,但被抛出为OSError。有解决此问题的解决方法吗?
谢谢。
答案 0 :(得分:2)
文件名中不能包含分号。
Date = datetime.today().strftime('%Y-%m-%d-%H:%M:%S')
将此更改为类似
Date = datetime.today().strftime('%Y-%m-%d-%H.%M.%S')