Kodeeksemplet du viste havde ellipser, og jeg tror, det er det, der er i ellipserne, der forårsager problemerne.
Du har:
SELECT R.[ID], C.[name] AS [company], ...
FROM [requests] AS R, ...
LEFT OUTER JOIN [companies] AS C
ON R.[company_id] = S.ID
Lad os sige, at det er noget i stil med:
SELECT R.[ID], C.[name] AS [company], X.Field
FROM [requests] AS R, [eXample] as X
LEFT OUTER JOIN [companies] AS C
ON R.[company_id] = S.ID
WHERE X.[request_id] = R.ID
Med andre ord blandingen af pre-ANSI 92 indre join syntaks med ANSI 92 outer join syntaks. Ved at teste på SQL Server 2005 ser det ud til, at aliasset R for anmodninger ikke ses forbi kommaet, der adskiller R fra ... i dit eksempel, og [eExample] som X i mit. Følgende virkede dog:
SELECT R.[ID], C.[name] AS [company], X.Field
FROM [eXample] as X, [requests] AS R
-- Requests and companies on the same side of the comma
LEFT OUTER JOIN [companies] AS C
ON R.[company_id] = S.ID
WHERE X.[request_id] = R.ID
eller
SELECT R.[ID], C.[name] AS [company], X.Field
FROM [requests] AS R LEFT OUTER JOIN [companies] AS C
ON R.[company_id] = S.ID, [eXample] as X
WHERE X.[request_id] = R.ID
-- Yuck, I would hate to find this. Not at all sure from reading
-- the code how it would work.
eller min favorit, fordi jeg kan lide ANSI 92 join-syntaks:
SELECT R.[ID], C.[name] AS [company], X.Field
FROM [requests] AS R
INNER JOIN [eXample] as X ON X.[request_id] = R.ID
LEFT OUTER JOIN [companies] AS C ON R.[company_id] = S.ID