我收到错误ORA-00907: missing right parenthesis
在sql开发人员中显示此行中存在语法错误syntax error expected: (
BUDGET_MANAGEMENT_SCENARIO.property_id = u.property_id,BUDGET_MANAGEMENT_SCARARIO.agency_id = u.agency_id
这是我的sql语句
SELECT
PROPERTY_NAME, AGENCY_NAME, ADVERTISER_NAME,
BUYING_AE_NAME, CLIENT_AE_NAME
FROM "BUDGET_MANAGEMENT_SCENARIO"
WHERE "BUDGET_MANAGEMENT_SCENARIO"."PROPERTY_ID" = 2 AND
"BUDGET_MANAGEMENT_SCENARIO"."QUARTER_ID" IN (17, 18, 19, 20) AND
((BUDGET_MANAGEMENT_SCENARIO.property_id =
u.property_id,BUDGET_MANAGEMENT_SCENARIO.agency_id = u.agency_id) # ERROR
IN (SELECT
property_id, agency_id
FROM "PACING_BUDGET_DETAIL"
WHERE (bae_app_user_id = 1 OR pae_app_user_id = 1 OR
cae_app_user_id = 1)
UNION
SELECT property_id, agency_id
FROM "USER_ASSIGNMENT"
WHERE "USER_ASSIGNMENT"."APP_USER_ID" = 1 AND
"USER_ASSIGNMENT"."PACING_BUDGET" = 1) u);
答案 0 :(得分:1)
正确的选择是:
SELECT b.bidID ,
b.requestID ,
b.notes ,
b.team ,
b.devDays ,
b.complexity ,
b.estimatedCost ,
b.actor ,
b.status,
REPLACE(CONVERT (VARCHAR (20), b.timestamp, 106), ' ', '-') AS timestamp,
e.PreferredName AS bidderFirstName,
e.LastName AS bidderLastName,
e.NTID AS bidderNTID
FROM dbo.BS_ToolRequests_Bids AS b
LEFT OUTER JOIN dbo.EmployeeTable AS e
ON b.actor = e.QID
WHERE b.requestID = t.requestID
FOR XML PATH ('data'), TYPE, ELEMENTS, ROOT ('bids')
问题出在(x = x1,y = y1)中(SELECT x1,y1)它应该是:(x,y)in(SELECT x1,y1)IT匹配精确行与x,y匹配( X1,Y1)
答案 1 :(得分:0)
以下是无效的SQL:
(BUDGET_MANAGEMENT_SCENARIO.property_id = u.property_id,BUDGET_MANAGEMENT_SCENARIO.agency_id = u.agency_id)
IN (SELECT ...
我不确定您要尝试做什么,但是您无法比较列并在IN (...)
子句中使用该比较的结果。
答案 2 :(得分:0)
缺少某些东西,或者这部分可能存在一些虚假的额外内容:
(BUDGET_MANAGEMENT_SCENARIO.property_id =
u.property_id,BUDGET_MANAGEMENT_SCENARIO.agency_id = u.agency_id)
也许你想要添加一些东西,就像这样?:
(BUDGET_MANAGEMENT_SCENARIO.property_id = u.property_id AND
u.property_id,BUDGET_MANAGEMENT_SCENARIO.agency_id = u.agency_id)