Here is the best example of writing an SQL query with multiple JOIN statements.

SQL Query with multiple Join Statements
SELECT m.f1, o.f1, s.f1
FROM Material m
LEFT OUTER JOIN Catalog c
ON m.MaterialName = c.MaterialName
AND m.EffectiveDate = c.EffectiveDate
AND c.MaterialType = 'X1' AND (c.MaterialName Like 'xyz%' OR
c.MaterialName Like '%abc')
LEFT OUTER JOIN OrderHeader o
ON o.OrderList = m.OrderList
AND o.OrderDate BETWEEN '01-01-2004' AND '12-31-2004'
LEFT OUTER JOIN Ship s
ON o.OrderList = s.OrderList
AND s.ShipVendorID in ('UPS','YF')
Related







You must be logged in to post a comment.