p.purchase_id,p.purchase_no,p.purchase_customer,p.purchase_date,p.purchase_status,pd.quity,pd.product_price,pd.purchase_id, sum(pd.product_price*pd.quity) as price from purchase p left join purchase_detail pd on p.purchase_id=pd.purchase_id where p.purchase_customer='7' order by p.purchase_id desc LIMIT 0 , 50