I had some help with this code:
SELECT *, IF(newcost - cost > 500, newcost - cost, 0) as raiseby FROM ( SELECT bp.*, b.company,(IF(bp.cost*1.2 < ls.ma