我不是训练有素的程序员,所以尝试这样做很困难。我收到此 SQL 代码的上述错误,但我无法找出原因。请指教。
SELECT a.agentname as 'Salesforce AgentName', a.loannumber, ag.agentname as 'portal agentname'
from salesforce a
inner join portal b ON a.loannumber = b.loannumber
left join agents ag ON b.agentid = ag.agentid
where a.agentname <> ag.agentname
最佳答案
有点猜测 ( based on here )
SELECT a.agentname AS 'Salesforce AgentName',
a.loannumber,
ag.agentname AS 'portal agentname'
FROM ((salesforce as a )
INNER JOIN portal as b
ON a.loannumber = b.loannumber)
LEFT JOIN agents ag
ON b.agentid = ag.agentid
WHERE a.agentname <> ag.agentname
顺便说一句,在
WHERE
子句中引用外部连接表列通常是错误的,除非您考虑到它们是 NULL
的可能性关于sql - 语法错误(缺少运算符),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/8948098/