MySQL Forums
Forum List  »  Newbie

equal to 0 if negative
Posted by: pedro dias
Date: March 10, 2009 05:17PM

update players_parts set

part_durability = (part_durability-(part_original_durability*4/100)),
part_current_durability = (part_current_durability-(part_current_durability*4/100))

where player_part_id = '".$player_part_id."' and player_id='".$player_id."'


hello, i have the querie above to avoid having to select first do the math with php and then update but i have a problem. If part_durability ends up being negative i want it to be 0. is there any way to do this? i understand IF statemts can only be used in SPs.

cheers

Options: ReplyQuote


Subject
Written By
Posted
equal to 0 if negative
March 10, 2009 05:17PM
March 10, 2009 05:56PM
March 10, 2009 06:02PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.