Combining Left and Inner Joins

Hello,

Is it possible to include an inner join within a series of left joins?

In other words:

Select TableA.*
FROM TableA
LEFT JOIN TableB
ON TableA.x=TableB.x
LEFT JOIN ????
(TableC INNER JOIN TableD
WHERE TableC.y > TableDy)

I put the question marks to indicate that I THINK I need some sort of alias for the subsequent inner join (if this is even possible…).

Thanks!

-Eric

The inner joins would need to come before the left joins.

It depends on what you need.


SELECT TableA.*
FROM TableA
INNER JOIN TableD
ON ....
LEFT JOIN TableB
ON TableA.x=TableB.x
LEFT JOIN TableC
ON ...


SELECT TableA.*
FROM TableA
LEFT JOIN TableB
ON TableA.x=TableB.x
LEFT JOIN
  (SELECT
      ....
   FROM TableC
   INNER JOIN TableD
   ON TableC.y > TableDy
  ) AS alias
ON ....

are two different queries that will give different results.

Thank you both. The syntax makes sense and I can see the differences in guido’s response.

-Eric