在线咨询
QQ咨询
服务热线
服务热线:13125520620
TOP

一个sql的update REPLACE的问题-数据库

发布时间:2011-11-12 浏览:4780

假设有一张表 ttable
id    domain1    domain2
1     abc.com    test.abc.com
2     eee.com    a.eee.com

update ttable set domain2=REPLACE(domain2,domain1,'test1.com'),domain1='test1.com'  where

id=1

update ttable set domain1='test1.com', domain2=REPLACE(domain2,domain1,'test1.com') where

id=2

将会有什么样的结果呢?
id    domain1    domain2
1     test1.com  test.test1.com
2     test1.com  a.eee.com

id=2的记录为什么REPLACE无效了呢? 那是因为domain1在REPLACE之前, 已经由eee.com更新成了

test1.com, 所以REPLACE就无效了.

TAG
软件定制,软件开发,瀚森HANSEN
0
该内容对我有帮助