使用DAY作为日期的postgresql语法错误

时间:2017-04-17 08:53:43

标签: postgresql

我无法识别此查询的语法错误,哪里是语法错误?

SELECT A.WPAN8, A.WPSRP1, A.WPBP01, A.WPSLSM, A.WP55QTA1, A.WPCENTYR, 
A.WPAAN01, A.WPAAN02, A.WPAAN03, A.WPAAN04, A.WPAAN05, A.WPAAN06, 
A.WPAAN07, A.WPAAN08, A.WPAAN09, A.WPAAN10, A.WPAAN11, A.WPAAN12, 
cast(((((((cast(cast(((WPUPMJ / 1000) + 1900) as decimal (4,0)) as 
char(4)) || '-01-01 ') || substring(cast(cast((WPUPMT + 1000000) as 
decimal (7,0)) as char(7)) from 2 for 2)) || ':') || 
substring(cast(cast((WPUPMT + 1000000) as decimal (7,0)) as char(7)) from 
4 for 2)) || ':') || substring(cast(cast((WPUPMT + 1000000) as decimal 
(7,0)) as char(7)) from 6 for 2)) as timestamp)+ 
ceiling(cast(substring(cast(cast(((WPUPMJ + 1900000) - 1) as decimal (7)) 
as character (7)) from 5 for 3) as decimal (3)))DAY as maxdate FROM 
CRPDTA.F5742001 A where cast(((((((cast(cast(((WPUPMJ / 1000) + 1900) as 
decimal (4,0)) as char(4)) || '-01-01 ') || substring(cast(cast((WPUPMT + 
1000000) as decimal (7,0)) as char(7)) from 2 for 2)) || ':') || 
substring(cast(cast((WPUPMT + 1000000) as decimal (7,0)) as char(7)) from 
4 for 2)) || ':') || substring(cast(cast((WPUPMT + 1000000) as decimal 
(7,0)) as char(7)) from 6 for 2)) as timestamp)+ 
ceiling(cast(substring(cast(cast(((WPUPMJ + 1900000) - 1) as decimal (7)) 
as character (7)) from 5 for 3) as decimal (3)))DAY > '2000-01-01 
00:00:00.000000';

在“DAY”或其附近说错误:语法错误

1 个答案:

答案 0 :(得分:0)

postgresql使用稍微不同的区间语法。

我认为您需要* '1 day'::interval而不是DAY