create procedure urgentbilltest ( @Vno int, @Vdt smalldatetime ) as begin select item.location, sum(salepurchase2.qty) AS QTY,sum(salepurchase2.fqty) AS FQTY, item.name, SALEPURCHASE2.MRP, item.pack, item.compname, salepurchase2.batch, salepurchase2.expiry from salepurchase2 inner join item on salepurchase2.itemc=item.code where ((salepurchase2.vdt= @Vdt+'%')) and salepurchase2.vtype in ('Sb', 's1') and (salepurchase2.vno in ( @Vno+'%')) group by salepurchase2.batch, item.location, item.name, item.pack, item.compname, SALEPURCHASE2.MRP, salepurchase2.expiry order by item.location end