Probably because the way you join. Try this:select d.shopcode ,d.memono ,d.txdate ,d.sku ,h.depositamt ,p.paymentcode ,p.paymentamt ,d.itemamt ,d.salesqty from xsoheader as h inner join xsodetail as d on d.shopcode=h.shopcode and d.memono=h.memono inner join xsopayment as p on p.shopcode=h.shopcode and p.memono=h.memono where d.sku in ('L000254','L000256') and h.voidflag='N' and d.txdate=convert(varchar(100),getdate(),112) compute sum(p.paymentamt) ,sum(d.salesqty)