From: Sashi on
Hi all,

I have three tables A, B and C.

I first want to run a simple select on tables B&C with a join and then
run a left join the result with A.

So:

Select A.a1, A.a2, A.a3..., BC.bc1, BC.bc2...
From A, (select bc1, bc2, bc3,... from B, C, where B.some_col =
C.some_col) BC
left join on A.another_col = BC.another_col.

What is the right syntax for this?
TIA,
Sashi
From: Plamen Ratchev on
Here is one way to write the query:

SELECT A.a1, A.a2, A.a3..., BC.bc1, BC.bc2...
FROM A
LEFT JOIN (
SELECT bc1, bc2, bc3,...
FROM B
JOIN C
ON B.some_col = C.some_col) AS BC
ON A.another_col = BC.another_col;

--
Plamen Ratchev
http://www.SQLStudio.com