I wrote two separate stored procedures and now need them both joined. They are both coming from different tables. I tried a Union after the first statement but it's not working. Here are the tables:ClearedDiary: PendingDiarySDW:Doc Doctotmet totovrSDWtotclr totpndSDWweekdat totpnddowrdat weekdat dowrdatHere's the two stored procedures. ALTER PROCEDURE [dbo].[offClearedAreaDist]@Area char(2),@Period char(1), @BgnDt datetime,@EndDt datetime AsIf @period = 'w'beginSelect area, dist, sum(totmet) as totm, sum(totclr) as totc, "perc"=Case When sum(totclr) = 0 then 0 When sum(totclr) = 0 then 0 Else(convert(decimal(6,2),((((sum(totmet)) * 1.00) / sum(totclr)) * 100))) End From ClearedDiary c inner join dbo.NatDocFile n on c.doc = n.docWhere Area = @Area and Weekdat = @BgnDtgroup by area,distorder by distendElsebeginSelect area, dist, sum(totmet) as totm, sum(totclr) as totc, "perc"=Case When sum(totclr) = 0 then 0 When sum(totclr) = 0 then 0 Else(convert(decimal(6,2),((((sum(totmet)) * 1.00) / sum(totclr)) * 100))) End From ClearedDiary c inner join dbo.NatDocFile n on c.doc = n.docWhere Area = @Area and Weekdat >= @BgnDt and Weekdat <= @BgnDtgroup by area,distorder by distendSelect area, dist, sum(totovrSDW) as totovrSDW, sum(totpndSDW) as totpndSDW, sum(totovr) as totovr, sum(totpnd) as totpnd From PendingDiarySDW p inner join dbo.NatDocFile n on p.doc = n.docWhere Area = @Area and Weekdat = @BgnDtgroup by area,distorder by dist