0
」附近的語法不正確它只是告訴我在附近有一個錯誤「。任何幫助?這是否意味着問題靠近一個空間?我見過其他人在'<'或';'附近遇到類似的問題,但不只是」。SQL Server錯誤102「
SELECT CO.JCCo, CO.Contract, CO.PCO AS PCO, CO.PCOType, MAX(CO.COStatus) AS Status, MAX(CO.COApprovedYN) AS Approved,
SUM(CO.COContPendAmt) AS PriceAmount,
SUM(CO.COCostDollars) AS CostAmount,
SUM(CO.COContPendAmt) - SUM(CO.COCostDollars) AS CO_Profit,
PMOP.Description, PMOP.PendingStatus, MAX(PMOP.DateCreated) AS PODate, GETDATE() AS Today, DATEDIFF(d, MAX(PMOP.DateCreated), GETDATE()) AS DaysOutstanding, (CASE WHEN (DATEDIFF(d, MAX(PMOP.DateCreated), GETDATE())) < 30 THEN 'Less than 30'
WHEN (DATEDIFF(d, MAX(PMOP.DateCreated), GETDATE())) > 30 AND (DATEDIFF(d, MAX(PMOP.DateCreated), GETDATE())) <= 60 THEN ' 30 - 60 ' WHEN (DATEDIFF(d, MAX(PMOP.DateCreated), GETDATE())) > 60 AND (DATEDIFF(d, MAX(PMOP.DateCreated), GETDATE())) <= 90 THEN ' 60 - 90 '
WHEN (DATEDIFF(d, MAX(PMOP.DateCreated), GETDATE())) > 90 THEN ' Over 90 ' ELSE 'Less than 30' END) AS AgingCategory,
PMOI.FixedAmount AS FixedAmount, PMOI.PendingAmount AS PendingAmount, PMOI.PCOItem,
(SELECT JCJM.ProjectMgr FROM JCJM WHERE JCJM.Job = CO.Contract AND JCJM.JCCo = 1) AS ProjectManager
FROM brvJCCostRevChgOrders AS CO
RIGHT JOIN PMOP ON CO.PCOType = PMOP.PCOType AND CO.PCO = PMOP.PCO AND CO.Contract = PMOP.Contract
RIGHT JOIN PMOI ON PMOP.PCOType = PMOI.PCOType AND PMOP.PCO = PMOI.PCO AND PMOP.Project = PMOI.Project
WHERE (PMOP.PendingStatus = 0) AND (CO.JCCo = 1) AND PMOP.Status <> 'VOID' AND PMOI.PMCo = 1 AND PMOP.PMCo = 1 AND (SELECT JCJM.ProjectMgr FROM JCJM WHERE JCJM.Job = CO.Contract AND JCJM.JCCo = 1) IS NOT NULL
GROUP BY CO.JCCo, CO.Contract, CO.PCO, PMOP.Description, CO.PCOType, PMOP.PendingStatus, PMOI.PCOItem, PMOI.FixedAmount, PMOI.PendingAmount
ORDER BY CO.Contract, CO.PCOType
靠近哪條線的語法不正確?你能給出整個錯誤信息嗎? –
我看到的唯一問題是你在where子句中有一個select可能返回多個值,Exists應該用來代替 – JamieD77
它不會說哪一行。它在Visual Studio中。它實際上只是告訴我錯誤102,錯誤的語法附近「。 –