if you can use sum syntax your can use Group and declare field of table don't use select * .Example :
Select sid,pvn ,item_name,sum(amt) as amt ,sum(qty) as Qty
From purchase
Where sid=$sid AND pvn!=0
Group by sid,item_name,pvn
ORDER BY pvn DESC LIMIT 3";
sorry my spelling bad.