MySQL Forums
Forum List  »  Newbie

-- advanced update / functions in UPDATE
Posted by: GTStefan
Date: May 09, 2005 05:21AM

Is it possible to use functions in an UPDATE?
For example I have to update a column "hp" with the smallest value. In this case it should be 101.

UPDATE charakter SET hp = min( 101, 166 ) WHERE char_id = '1'

I hope the function min() is existing in MySQL. This query return a error message:
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ' 166) WHERE char_id = "1"' at line 1

Options: ReplyQuote


Subject
Written By
Posted
-- advanced update / functions in UPDATE
May 09, 2005 05:21AM


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.