Is it possible to execute mysql if / then using math?
Say ...
if product_name = "apple" then divide product_price by 4 else do no math on product_price
A link to a tutorial on something similar, or any help / direction would be appreciated.
I ended up using the bluefeet method with that too. A model for everyone who might need in the future,
SELECT DISTINCT 12345_parts.*, 12345_parts.install_meter + 12345_parts.meter_life - 12345_parts.prior_meter AS nextdue, CASE WHEN 12345_parts.part_name = "JET ENGINE" THEN 12345_parts.meter_life + 12345_parts.install_meter - 12345_parts.prior_meter - status_12345.meter / 4 ELSE 12345_parts.meter_life + 12345_parts.install_meter - 12345_parts.prior_meter - status_12345.meter END AS remainder FROM 12345_parts, status_12345 WHERE 12345_parts.overhaul LIKE '%HLY%' AND 12345_parts.active='ACTIVE'
source share