<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></title> 
<link>http://www.jackxiang.com/index.php</link> 
<description><![CDATA[赢在IT，Playin' with IT,Focus on Killer Application,Marketing Meets Technology.]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></copyright>
<item>
<link>http://www.jackxiang.com/post//</link>
<title><![CDATA[Mysql.sql语句：concat和replace语句的混用实现功能]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[WEB2.0]]></category>
<pubDate>Wed, 19 Mar 2008 07:18:05 +0000</pubDate> 
<guid>http://www.jackxiang.com/post//</guid> 
<description>
<![CDATA[ 
	Simple Demo:<br/><textarea name="code" class="php" rows="15" cols="100">
update t_tst_projects set f_Tester = CONCAT(f_Tester,&quot;;jack@beyondsoft.com&quot;)&nbsp;&nbsp; where f_Id in(12,77,78,79,80,81);
</textarea><br/><br/>concat和Max混合用法：<br/><textarea name="code" class="php" rows="15" cols="100">
SELECT max(CONCAT(f_Date, &#039; &#039;, f_Time))&nbsp;&nbsp;FROM t_task_ip_mapping&nbsp;&nbsp;&nbsp;&nbsp; WHERE f_TaskId = 96 AND f_Gray = 1;

</textarea><br/><br/>select * from domain where enterpriseid=&#039;95358&#039;;<br/><br/>update `domain` set name=replace(name,name,concat(name,&quot;shenbak&quot;)) where name not like &quot;%shenbak&quot; and enterpriseid=&#039;95358&#039; ; <br/>%表示后面有shenbak的，但是加了not，于是就没有问题了！<br/><br/>还回来：<br/>update `domain` set name=replace(name,&quot;shenbak&quot;,&quot;&quot;) where name like &quot;%shenbak&quot; and enterpriseid=&#039;95358&#039;; <br/><br/>update `film_info` set IMDB=REPLACE ( IMDB,&#039;tt&#039;,&#039;&#039;);//将IMDB码的tt去掉，好建立索引<br/><br/><br/>在数据转换的时候需要用到mysql的replace函数，这里简单介绍一下！<br/><br/>比如你要将 表 tb1里面的 f1字段的abc替换为def<br/><br/>Update tb1 SET f1=REPLACE(f1, &#039;abc&#039;, &#039;def&#039;);<br/><br/>REPLACE(str,from_str,to_str)&nbsp;&nbsp;&nbsp;&nbsp;<br/>在字符串&nbsp;&nbsp; str&nbsp;&nbsp; 中所有出现的字符串&nbsp;&nbsp; from_str&nbsp;&nbsp; 均被&nbsp;&nbsp; to_str替换，然后返回这个字符串：&nbsp;&nbsp;&nbsp;&nbsp;<br/>mysql&gt;&nbsp;&nbsp; Select&nbsp;&nbsp; REPLACE(&#039;www.mysql.com&#039;,&nbsp;&nbsp; &#039;w&#039;,&nbsp;&nbsp; &#039;Ww&#039;);&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&gt;&nbsp;&nbsp; &#039;WwWwWw.mysql.com&#039;&nbsp;&nbsp;<br/>这个函数是多字节安全的。<br/><br/>示例：<br/>Update&nbsp;&nbsp;`dede_addonarticle`&nbsp;&nbsp;SET body =&nbsp;&nbsp;REPLACE ( body,<br/>&#039;&lt;/td&gt;&#039;,<br/>&#039;&#039; );<br/>Update&nbsp;&nbsp;`dede_addonarticle`&nbsp;&nbsp;SET body =&nbsp;&nbsp;REPLACE ( body,<br/>&#039;&lt;/tr&gt;&#039;,<br/>&#039;&#039; );<br/>Update&nbsp;&nbsp;`dede_addonarticle`&nbsp;&nbsp;SET body =&nbsp;&nbsp;REPLACE ( body,<br/>&#039;&lt;tr&gt;&#039;,<br/>&#039;&#039; );&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>Update&nbsp;&nbsp;`dede_archives`&nbsp;&nbsp;SET title=&nbsp;&nbsp;REPLACE ( title,<br/>&#039;大洋新闻 - &#039;,<br/>&#039;&#039; );&nbsp;&nbsp;<br/>Update&nbsp;&nbsp;`dede_addonarticle`&nbsp;&nbsp;SET body =&nbsp;&nbsp;REPLACE ( body,<br/>&#039;../../../../../../&#039;,<br/>&#039;http://special.dayoo.com/meal/&#039; ); <br/><br/>mysql replace<br/><br/>用法1.replace intoreplace into table (id,name) values(‘1‘,‘aa‘),(‘2‘,‘bb‘)<br/>此语句的作用是向表table中插入两条记录。<br/>2.replace(object, search,replace)<br/>把object中出现search的全部替换为replaceselect replace(‘www.163.com‘,‘w‘,‘Ww‘)---&gt;WwW wWw.163.com<br/><br/>例：把表table中的name字段中的 aa替换为bbupdate table set name=replace(name,‘aa‘,‘bb‘) <br/><br/>本文转载自『北漂石头的博客』<br/>http://www.niutian365.com/blog/<br/>更多精彩内容,欢迎访问北漂石头的博客!
]]>
</description>
</item><item>
<link>http://www.jackxiang.com/post//#blogcomment</link>
<title><![CDATA[[评论] Mysql.sql语句：concat和replace语句的混用实现功能]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://www.jackxiang.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>