russell's is nice! why don't you pass in NULL instead and use COAELSCE or ISNULL which will make it one sproc with no IFcreate table pleasesupplydata(acct int, premise int, reid int, [read] int)INSERT INTO pleasesupplydatavalues(175029, 1750, 1, 264 )INSERT INTO pleasesupplydatavalues(175029, 1750, 1, 88 )INSERT INTO pleasesupplydatavalues(175029, 1750, 1, 20 )INSERT INTO pleasesupplydatavalues(175029, 1750, 2, 43 )INSERT INTO pleasesupplydatavalues(175029, 1750, 2, 90 )INSERT INTO pleasesupplydatavalues(175029, 1750, 2, 96)declare @acct int = nullSELECT t1.acct, t1.premise, reid1, reid2, read1, read2FROM ( SELECT acct, premise, reid as reid1, [read] as read1 FROM pleasesupplydata where reid = 1 and acct = COALESCE( @acct, acct)) t1LEFT JOIN ( SELECT acct, premise, reid as reid2, [read] as read2 FROM pleasesupplydata where reid = 2 and acct = COALESCE( @acct, acct)) t2On t1.acct = t2.acctAnd t1.premise = t2.premise;
<><><><><><><><><><><><><><><><><><><><><><><><><>If you don't have the passion to help people, you have no passion