L'exemple de code que vous avez montré comportait des points de suspension et je pense que c'est ce qu'il y a dans les points de suspension qui causent des problèmes.
Vous avez :
SELECT R.[ID], C.[name] AS [company], ...
FROM [requests] AS R, ...
LEFT OUTER JOIN [companies] AS C
ON R.[company_id] = S.ID
Disons que c'est quelque chose comme :
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
En d'autres termes, le mélange de la syntaxe de jointure interne pré-ANSI 92 avec la syntaxe de jointure externe ANSI 92. En testant sur SQL Server 2005, il apparaît que l'alias R pour les requêtes n'est pas vu au-delà de la virgule qui sépare R de ... dans votre exemple, et [eXample] comme X dans le mien. Ce qui suit a cependant fonctionné :
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
ou
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.
ou mon préféré, car j'aime la syntaxe de jointure ANSI 92 :
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