ALTER PROCEDURE dbo.selectCustomerCNameCount @customerID int AS if @customerID=-1 begin select contentownerid ,userCName,count(*) as countAll from view_usercomment group by contentownerid,userCName order by contentownerid DESC end else begin select contentownerid ,userCName,count(*) as countAll from view_usercomment where contentownerid=@customerID group by contentownerid,userCName order by contentownerid DESC end |