Skip to main content
"MySQL doesn't have == operator" same edit as answer https://stackoverflow.com/a/40544590/1393894, as they are the same answer. This answer was posted first.
Source Link

You can try this also

 SelectSELECT id , IF(type=='p'type='p', IFNULL(amount,0), IFNULL(amount,0) * -1) as amount fromFROM table

You can try this also

 Select id , IF(type=='p', IFNULL(amount,0), IFNULL(amount,0) * -1) as amount from table

You can try this also

 SELECT id , IF(type='p', IFNULL(amount,0), IFNULL(amount,0) * -1) as amount FROM table
Source Link

You can try this also

 Select id , IF(type=='p', IFNULL(amount,0), IFNULL(amount,0) * -1) as amount from table