开发者

How to update a field using alias in mysql?

开发者 https://www.devze.com 2023-04-13 09:09 出处:网络
I am having a table in mysql, and in that i am having two fields that is id and desc, now as desc is a mysql keyword, i am unable to update that field because mysql is giving syntax error, so i though

I am having a table in mysql, and in that i am having two fields that is id and desc, now as desc is a mysql keyword, i am unable to update that field because mysql is giving syntax error, so i thought why not update that field by using alias, i used it but not working, is there any way to update that field using alias. Please help! I need it very badly. Th开发者_StackOverflow中文版anks Ravinder


Try with:

UPDATE t1 SET `desc`='NEW VAL'

Notice the single backquotes ( ` ) around the desc field name

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号