开发者

SQL Update - Deleting last 45 char of a string

I want to delete last 45 开发者_JAVA技巧char of an attribute in all rows. What can I do ?


UPDATE tablename
   SET fieldname = IF(LENGTH(fieldname) > 45,
                      SUBSTR(fieldname, 1, LENGTH(fieldname) - 45),
                      fieldname)


try this :

update table
set column = right(column , 44) 
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜