记录几条苹果cms的mysql语句

  • 内容
  • 评论
  • 相关
示例:
查找播放器组 “vod_play_from” 中包含 “html” 的数据
SELECT * FROM `mac_vod` WHERE `vod_play_from` LIKE '%html%'
替换播放器组 “vod_play_from” 中包含 “html” 的字段为 “noplay”
UPDATE mac_vod SET vod_play_from =  'noplay' WHERE vod_play_from LIKE  '%html%'

1)查找
跳转URL
SELECT * FROM `mac_vod` WHERE `vod_jumpurl` LIKE '%[db:%'
副标
SELECT * FROM `mac_vod` WHERE `vod_sub` LIKE '%[db:%'
上映日期
SELECT * FROM `mac_vod` WHERE `vod_pubdate` LIKE '%[db:%'
版本
SELECT * FROM `mac_vod` WHERE `vod_version` LIKE '%[db:%'
编辑人
SELECT * FROM `mac_vod` WHERE `vod_author` LIKE '%[db:%'
资源类别
SELECT * FROM `mac_vod` WHERE `vod_state` LIKE '%[db:%'

2)替换
跳转URL	
UPDATE mac_vod SET vod_jumpurl =  '' WHERE vod_jumpurl LIKE  '%[db:%'
副标
UPDATE mac_vod SET  `vod_sub` =  '' WHERE  `vod_sub` LIKE  '%[db:%'
上映日期
UPDATE mac_vod SET  `vod_pubdate` =  '' WHERE  `vod_pubdate` LIKE  '%[db:%'
版本
UPDATE mac_vod SET  `vod_version` =  '' WHERE  `vod_version` LIKE  '%[db:%'
编辑人
UPDATE mac_vod SET  `vod_author` =  '' WHERE  `vod_author` LIKE  '%[db:%'
资源类别
UPDATE mac_vod SET vod_state = '' WHERE vod_state LIKE '%[db:%'
演员
UPDATE mac_vod SET vod_actor =  '' WHERE vod_actor LIKE  '%[db:%'

3)整合替换命令
UPDATE mac_vod SET `vod_jumpurl` =  '' WHERE `vod_jumpurl` LIKE  '%[db:%';
UPDATE mac_vod SET  `vod_sub` =  '' WHERE  `vod_sub` LIKE  '%[db:%';
UPDATE mac_vod SET  `vod_pubdate` =  '' WHERE  `vod_pubdate` LIKE  '%[db:%';
UPDATE mac_vod SET  `vod_version` =  '' WHERE  `vod_version` LIKE  '%[db:%';
UPDATE mac_vod SET  `vod_author` =  '' WHERE  `vod_author` LIKE  '%[db:%';
UPDATE mac_vod SET `vod_state` = '' WHERE `vod_state` LIKE '%[db:%';
UPDATE mac_vod SET vod_actor =  '' WHERE vod_actor LIKE  '%[db:%';

4)删除指定字段中包含的指定字符
删除 vod_play_url 中的 '/> 字符(删除字段中包含的某个字符)
UPDATE mac_vod SET  `vod_play_url` = REPLACE(  `vod_play_url` ,  "'/>",  "" )

评论

2条评论
  1. Gravatar 头像

    lmarch 回复

    ❗ 快快快

  2. Gravatar 头像

    l 回复

    查询不包含某字符的数据:SELECT * FROM `mac_vod` WHERE `vod_pic` not like "%http%"

发表评论

电子邮件地址不会被公开。 必填项已用*标注