mysql常用sql命令语句列表(菜鸟专用)

记录一下常用的sql语句,方便随时使用:

计算一列的和值:

select sum(userfen) from phome_enewsmember

将一列的值加到另外一列上
update phome_enewsmember set userfen=userfen+income*0.6

将phome_ecms_news的xiazai字段所有值设置为如下链接

update phome_ecms_news set xiazai='https://ugame.9game.cn/game/downloadGame?pack.cooperateModelId=215453&pack.id=40616664'

带条件替换,比如栏目为17的

update www_kaifamei_com_ecms_download set xiazai='https://ugame.9game.cn/game/downloadGame?pack.cooperateModelId=215453&pack.id=40616664' where classid=17

去除换行/回车符

update phome_ecms_news set title = REPLACE(REPLACE(title, CHAR(10), ''), CHAR(13),'') ;

去除空格

select trim(字段名) from 表名;