我试图了解我的SQL代码中发生无效标识符错误的位置。输出状态,"命令行错误:9列:10"这是" on"功能在"加入"功能。任何帮助将不胜感激。
这是我的代码:
select
TO_CHAR(TRUNC("SITE_UPLOAD_DATA_UPLOAD_TIME", 'MM'), 'MON') as month,
cast (avg("DATA_POINT_UPLOAD_DATA"."value") as int) as "PAST_VALUE"
from
"TEST"."DATA_POINT_UPLOAD_DATA",
"TEST"."COMPONENT_UPLOAD_DATA"
join
"TEST"."COMPONENT_DATA_POINT"
on "DATA_POINT_UPLOAD_DATA"."COMPONENT_DATA_POINT_ID" = "COMPONENT_DATA_POINT"."ID"
where
"COMPONENT_DATA_POINT"."NAME" = 'ready_go'
and "COMPONENT_UPLOAD_DATA"."SITE_UPLOAD_DATA_SITE_ID" = ('abc123')
and "SITE_UPLOAD_DATA_UPLOAD_TIME" between TRUNC (ADD_MONTHS ('01-MAR-17', - 13), 'MM') and TRUNC (LAST_DAY (ADD_MONTHS ('31-MAR-17', - 1)) + 1)
group by
TRUNC("SITE_UPLOAD_DATA_UPLOAD_TIME", 'MM'),
"COMPONENT_UPLOAD_DATA"."SITE_UPLOAD_DATA_SITE_ID"
order by
TRUNC("SITE_UPLOAD_DATA_UPLOAD_TIME", 'MM') desc;
答案 0 :(得分:0)
正如我从您发布的查询中看到的那样,您应该有两个JOIN
,而您只指定一个JOIN ON
条件
from
"TEST"."DATA_POINT_UPLOAD_DATA"
JOIN "TEST"."COMPONENT_UPLOAD_DATA" ON <some_condition>
join
"TEST"."COMPONENT_DATA_POINT"
on "DATA_POINT_UPLOAD_DATA"."COMPONENT_DATA_POINT_ID" = "COMPONENT_DATA_POINT"."ID"