Try
select S.*, O.Price, O.Description
from Summary S INNER JOIN OrderItems O on S.OrderId = O.OrderID WHERE S.OrderID IS NOT NULL
UNION ALL
SELECT S.*, SI.Price, SI.Description
FROM Summary S INNER JOIN StockItems SI ON S.ItemId = SI.ItemID where S.OrderIS IS NULL
-------------------
This assumes both tables have the same structure. Otherwise just list the columns from both tables.
For every expert, there is an equal and opposite expert. - Becker's Law
My blog
My TechNet articles
No comments:
Post a Comment