 <pre><code>declare @startDate datetime, @endDate datetime select @startDate = '1/1/2012', @endDate = '2/1/2012' select p.Name as Plant, (select sum(Quantity) from Parts where PlantID = p.ID and date between @startDate and @endDate) as Parts, (select sum(Quantity) from Rejects where PlantID = p.ID and date between @startDate and @endDate) as Rejects from Plant p where p.endDate is null </code></pre>