Derby可以处理SELECT子句中的标量子查询吗?

时间:2013-12-06 21:20:23

标签: sql join derby scalar

我无法让查询正常工作。请问某人有经验的眼睛吗?表结构很简单(2个一对多关系)。查询正在尝试计算每个符号,每个唯一的“PositionLocation”有多少贡献。

Sign <- Signifier (f_key sign_oid) <- Contribution (f_key signifier_oid)

我收到以下错误:

Error: An ON clause associated with a JOIN operator is not valid.
SQLState:  42972
ErrorCode: -1

我的查询是:

select s.NAME, c.POSITIONLOCATION, count(*) as num_per_locn,
(
    select count(*) from APP.CONTRIBUTION c2
    inner join APP.SIGNIFIER si2 on si2.OID = c2.SIGNIFIER_OID
    inner join APP.SIGN s2 on s2.OID = si2.SIGN_OID
    and  s2.OID = s.OID
) as num_per_sign
from APP.CONTRIBUTION c
inner join APP.SIGNIFIER si on si.OID = c.SIGNIFIER_OID
inner join APP.SIGN s on s.OID = si.SIGN_OID
group by s.NAME, c.POSITIONLOCATION

0 个答案:

没有答案