Teradata SQL:错误4566 - 查询失败,但为同事工作

时间:2017-07-11 21:26:42

标签: sql teradata

我从同事那里继承了一个适合他们的查询。我有相同的数据库访问权限并以相同的方式设置我的ODBC驱动程序,虽然我使用Teradata与Query Chameleon来运行查询。不同之处在于,每次运行查询时,我都会:

  

SELECT失败。 4566:关系"<>"不存在

有没有办法解决这个问题?

(这是几个经历同样失败的查询中最简单的一个:)

SELECT CAST(DR.month_id AS INTEGER) AS DATE
    ,CAST(SUM(LD.Count) AS INTEGER) AS Count
    ,CAST(SUM(LD.revenue) AS FLOAT) AS Revenue 
    ,CAST(SUM(LD.revenue) / SUM(LD.Count)  AS FLOAT) AS AvgRevPerUnit 
    ,CAST(SUM(LD.Count) / SUM(LD.Count) AS FLOAT) AS AttachRate
FROM database1                  AS OS
INNER JOIN database2        AS LD ON (LD.id = OS.id)
INNER JOIN database3                    AS LT ON (LD.id = LT.id)
INNER JOIN database4            AS DR ON (LD.id = DR.id)
INNER JOIN database5    AS FS ON (LD.id = FS.id)
WHERE 0 = 0
    AND OS.desc IN ('Description I want')
    AND DR.year >= (YEAR(current_date) - 2)
    AND LT.desc = ('ABREV')
    AND FS.code NOT IN ('CANCELED')
GROUP BY 1
ORDER BY 1

0 个答案:

没有答案