-- 清除各个字段两头的引号
-- update `jyp_idnews` set title = right(title, length(title)-1) WHERE title like '"%';
-- update `jyp_idnews` set title = LEFT(title, length(title)-1) WHERE title like '%"';
-- update `jyp_idnews` set content = right(content, length(content)-1) WHERE content like '"%';
-- update `jyp_idnews` set content = LEFT(content, length(content)-1) WHERE content like '%"';
-- update `jyp_idnews` set thumb = right(thumb, length(thumb)-1) WHERE thumb like '"%';
-- update `jyp_idnews` set thumb = LEFT(thumb, length(thumb)-1) WHERE thumb like '%"';
-- update `jyp_idnews` set keywords = right(keywords, length(keywords)-1) WHERE keywords like '"%';
-- update `jyp_idnews` set keywords = LEFT(keywords, length(keywords)-1) WHERE keywords like '%"';
-- update `jyp_idnews` set description = right(description, length(description)-1) WHERE description like '"%';
-- update `jyp_idnews` set description = LEFT(description, length(description)-1) WHERE description like '%"';
-- 更新条件中所有字段状态为1
-- update `jyp_idnews` set status=1 where id<198180;
-- 查询范围内所有的非图片字段数量
-- SELECT count(1) FROM `jyp_idnews`
-- WHERE thumb NOT LIKE '%.jpg'
-- AND thumb NOT LIKE '%.jpeg'
-- AND thumb NOT LIKE '%.png'
-- AND thumb NOT LIKE '%.gif'
-- AND id<198180;
-- 更新范围内所有的非图片状态为0
-- update `jyp_idnews` set status=0
-- WHERE thumb NOT LIKE '%.jpg'
-- AND thumb NOT LIKE '%.jpeg'
-- AND thumb NOT LIKE '%.png'
-- AND thumb NOT LIKE '%.gif'
-- AND id<198180;
SQL批量语句
于 2023-11-29 10:21:48 首次发布