1 declare @result table 2 ( 3 custid int, 4 ordermonth datetime, 5 qty int, 6 runqty int, 7 primary key(custid,ordermonth) 8 ); 9 10 declare 11 @custid as int, 12 @prvcustid as int, 13 @ordermonth as datetime, 14 @qty as int, 15 @runqty as int; 16 de