php - Return positive value always even if it is negative -
select c.firstname,c.lastname,s.salesprice,p.recommendedprice,s.salesprice - p.recommendedprice customers c inner join sales s on c.customerid=s.customerid inner join products p on s.productid=p.productid
i know maths has function don't know specific function use in mysql.
i have difference table needs returned positive.
for example: difference -50 , want +50 in column.
according query s.salesprice - p.recommendedprice
calculating price has refunded. put abs
before calculation. below query
select c.firstname,c.lastname,s.salesprice,p.recommendedprice,abs(s.salesprice - p.recommendedprice) customers c inner join sales s on c.customerid=s.customerid inner join products p on s.productid=p.productid
for more information
Comments
Post a Comment