Prev: Update table in SQL replacing the existing value
Next: select into temp table slower on 8way box
From: Sashi on 20 May 2010 12:24 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 20 May 2010 13:08 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
|
Pages: 1 Prev: Update table in SQL replacing the existing value Next: select into temp table slower on 8way box |