Im trying to translate an SQL query to OPENQUERY. I have this code that works well:
Select
F_ART.CODART,
F_ART.REFART,
F_ART.DESART,
F_LTA.PRELTA,
F_STO.DISSTO,
F_PRO.NOCPRO,
F_FAM.DESFAM,
F_SEC.DESSEC
From
[LINKED]...F_ART Inner Join
[LINKED]...F_FAM On F_FAM.CODFAM = F_ART.FAMART Inner Join
[LINKED]...F_LTA On F_LTA.ARTLTA = F_ART.CODART Inner Join
[LINKED]...F_PRO On F_PRO.CODPRO = F_ART.PHAART Inner Join
[LINKED]...F_SEC On F_SEC.CODSEC = F_FAM.SECFAM Inner Join
[LINKED]...F_STO On F_STO.ARTSTO = F_ART.CODART
I want to transform it to use OPENQUERY so I have tried this code:
Select
CODART,
REFART,
DESART,
IMGART,
DISSTO
From
OPENQUERY ([LINKED], 'SELECT * FROM
F_ART Inner Join
F_STO On (F_STO.ARTSTO = F_ART.CODART)
')
But when I add the next Inner Join sentences it fails.
Can I use multiple Inner Join with openquery?
Im using this code from MS ACCESS to query a Linked SQL Server.
I have solved this creting a 'View' in the SQL server.
That 'View' contains all the 'Joins' needed.
Then I create the query pointing to the 'View'.