Not sure how to word the subject ...I have a sproc as seen below -CREATE PROCEDURE myProc@PageID intASSELECT left(ZoneNo,5) + '0' as ZoneNo, area as [Area], max(case when month(proddate) = 1 then 1 else 0 end) as [Jan], max(case when month(proddate) = 2 then 1 else 0 end) as [Feb], max(case when month(proddate) = 3 then 1 else 0 end) as [Mar], max(case when month(proddate) = 4 then 1 else 0 end) as [Apr], max(case when month(proddate) = 5 then 1 else 0 end) as [May], max(case when month(proddate) = 6 then 1 else 0 end) as [Jun], max(case when month(proddate) = 7 then 1 else 0 end) as [Jul], max(case when month(proddate) = 8 then 1 else 0 end) as [Aug], max(case when month(proddate) = 9 then 1 else 0 end) as [Sep], max(case when month(proddate) = 10 then 1 else 0 end) as [Oct], max(case when month(proddate) = 11 then 1 else 0 end) as [Nov], max(case when month(proddate) = 12 then 1 else 0 end) as [Dec]FROM tblcontractdetailWHERE (franchiseid = 'mdiccl') and productid = @PageID and ProdYear = 2010 group by (left(ZoneNo,5) + '0'), area order by (left(ZoneNo,5) + '0') descGO
But what I want to now do is have the case information be based off the @PageID I pass in. So instead of returning no results if say @PageID = 174. I rather it return all my zones, areas where WHERE (franchiseid = 'mdiccl') and ProdYear = 2010 with 0's across in my case statement b/c the @PageID returns no results. And obviously if there is data matching the @PageID i pass in the 1's and 0's would fill in appropriately.Let me know if I am not explaining this well.