我有这个代码组合2个表,我想从说vBoAdd C添加第三个。我需要在哪里添加其他INNER JOIN代码行?
Select A.ID, A.SUPPLIER_SPECIALTY, B.Code, B.Description,
C.Address1 + ' ' + C.Address2 + ' '+ C.Address3 AS Address, C.Phone
FROM vBoCsGeneralLookupTables B
INNER JOIN (
SELECT A.ID,
Split.a.value('.', 'VARCHAR(100)') AS SUPPLIER_SPECIALTY
FROM
(
SELECT ID,
CAST ('<M>' + REPLACE(SUPPLIER_SPECIALTY, ',', '</M><M>') + '</M>' AS XML) AS SUPPLIER_SPECIALTY
FROM JOA_COMPANY_DEMO A
WHERE SUPPLIER_SPECIALTY != ''
) AS A CROSS APPLY SUPPLIER_SPECIALTY.nodes ('/M') AS Split(a)
) A
ON A.SUPPLIER_SPECIALTY=B.Code
WHERE B.TableName = 'SUPPLIER_SPECIALTY'
答案 0 :(得分:0)
下一个INNER JOIN
可以在您的WHERE
子句之前,在ON
INNER JOIN
的{{1}}条款之后。