SELECT A.Id as ID,
A.Industry__c as Industry
FROM Opportunity AS A
LEFT JOIN ACCOUNT AS B
ON A.AccountId = B.Id
LEFT JOIN User AS C --Error here; there is a table called USER still getting an error
ON A.OWNERID = C.USERROLEID
Where CloseDate BETWEEN '2021/01/01' and '2021/03/31'
AND StageName IN ('WON AND CLOSED', 'H. WON AND CLOSED')
正在给出错误:
在需要条件的上下文中指定的非布尔类型的表达式Near LEFT JOIN USER
USER
是SQL Server中的保留字。
试着把它放在方括号里。
SELECT A.Id as ID,
A.Industry__c as Industry
FROM Opportunity AS A
LEFT JOIN ACCOUNT AS B
ON A.AccountId = B.Id
LEFT JOIN [User] AS C
ON A.OWNERID = C.USERROLEID
Where CloseDate BETWEEN '2021/01/01' and '2021/03/31'
AND StageName IN ('WON AND CLOSED', 'H. WON AND CLOSED')