MySQL 5.5 Community Server
MySQL 5.6 Community Server
Percona Configuration Wizard
XtraBackup 搭建主从复制
Great Sites on MySQL
Percona
MySQL Performance Blog
Severalnines
推荐管理工具
Sequel Pro
phpMyAdmin
推荐书目
MySQL Cookbook
MySQL 相关项目
MariaDB
Drizzle
参考文档
http://mysql-python.sourceforge.net/MySQLdb.html
zjsxwc
V2EX  ›  MySQL

谁能解释下为什么这条 sql 没有一次把所有数据更新

  •  
  •   zjsxwc ·
    zjsxwc · Oct 22, 2018 · 2440 views
    This topic created in 2767 days ago, the information mentioned may be changed or developed.

    我想把 product 表的 detail 字段里的字符串'http://cdn.CDN_URL' 替换为 'CDN_URL',共有 400 多条数据,

    于是执行了这条 sql:

    UPDATE `product` SET detail=REPLACE(detail, 'http://cdn.CDN_URL', 'CDN_URL')
    

    但是执行完后我再次通过这条 sql 搜索

    SELECT * FROM `product`  WHERE detail LIKE '%http://cdn.CDN_URL%'
    ORDER BY `product`.`id`  DESC
    

    返回表示数据库里还有 24 条数据,

    问题:为什么我第一条 sql 没有把数据都改掉?

    +++++++

    发完贴我好像想到了,结贴,应该是原先有数据'http://cdn.http://cdn.CDN_URL'这种数据,汗。。

    2 replies    2018-11-23 22:32:03 +08:00
    ywlvs
        1
    ywlvs  
       Nov 15, 2018
    涨见识了!
    xyjincan
        2
    xyjincan  
       Nov 23, 2018 via Android
    😒
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1027 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 42ms · UTC 19:33 · PVG 03:33 · LAX 12:33 · JFK 15:33
    ♥ Do have faith in what you're doing.