嘿伙计们,我正在尝试在我的 postgres 数据库中运行此查询,但它返回一个错误:[Err] ERROR: syntax error at or near "," LINE 13: 而不是 substr(a.zoneiddest , 1 ,3) = any ( '254','255','256'...
查询是这样的
SELECT
to_char(a.CALLDATE, 'yyyymm') AS month,
min(a.calldate) AS start_time,
max(a.calldate) AS end_time,
ceil(SUM(a.CALLDURATION::INT) / 60) AS minutes,
COUNT(DISTINCT a.IDENTIFIANT) AS distinct_callers,
a.zoneiddest AS country_code,
b.country
FROM cdr_data a,
country_codes b
WHERE a.CALLSUBCLASS = '002'
AND a.CALLCLASS = '008'
AND a.zoneiddest::INT > 0
AND SUBSTR(a.CALLEDNUMBER, 1, 2) NOT IN
( '77', '78', '75', '70', '71', '41', '31', '39', '76', '79' )
AND NOT substr(a.zoneiddest, 1, 3) = ANY
( '254', '255','256', '211', '257', '250', '256' )
AND trim(a.zoneiddest) = trim(b.country_code)
GROUP BY
to_char(a.CALLDATE, 'yyyymm'),
a.zoneiddest,
b.country
ORDER BY 1
同样的查询在 oracle 中运行良好,只需将 a.zoneiddest::integer > 0 更改为 a.zoneiddest > 0
我可能做错了什么