<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></title> 
<link>http://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://jackxiang.com/post//</link>
<title><![CDATA[[实践用到]mysql coalesce的函数用法]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[WEB2.0]]></category>
<pubDate>Tue, 31 Jan 2012 08:18:43 +0000</pubDate> 
<guid>http://jackxiang.com/post//</guid> 
<description>
<![CDATA[ 
	coalesce函数表示可以返回参数中的第一个非空表达式，当你有N个参数时选取第一个非空值（从左到右）。<br/>实例一：<br/>select coalesce(null,&quot;carrot&quot;,&quot;apple&quot;);<br/>返回结果：carrot<br/>mysql&gt; select coalesce(null,&quot;carrot&quot;,&quot;apple&quot;);<br/>+---------------------------------+<br/>&#124; coalesce(null,&quot;carrot&quot;,&quot;apple&quot;) &#124;<br/>+---------------------------------+<br/>&#124; carrot&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#124; <br/>+---------------------------------+<br/>实例二：<br/>select coalesce(1,&quot;carrot&quot;,&quot;apple&quot;)<br/>返回结果：1<br/>友情提示：coalesce里的参数如果是字符串的话，务必用单引号或者双引号廓起来；<br/>这些语句可以直接在mysql里运行。<br/>mysql&gt; select coalesce(1,&quot;carrot&quot;,&quot;apple&quot;);<br/>+------------------------------+<br/>&#124; coalesce(1,&quot;carrot&quot;,&quot;apple&quot;) &#124;<br/>+------------------------------+<br/>&#124; 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#124; <br/>+------------------------------+<br/>1 row in set (0.00 sec)<br/>实际用到在查询时有可能是null时，显示0，如下 ：<br/>mysql&gt; select coalesce(null, 0);&nbsp;&nbsp; <br/>+-------------------+<br/>&#124; coalesce(null, 0) &#124;<br/>+-------------------+<br/>&#124; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#124; <br/>+-------------------+<br/>1 row in set (0.00 sec)<br/><br/>mysql&gt; select coalesce(&#039;1&#039;, 0);<br/>+------------------+<br/>&#124; coalesce(&#039;1&#039;, 0) &#124;<br/>+------------------+<br/>&#124; 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#124; <br/>+------------------+<br/>1 row in set (0.00 sec)
]]>
</description>
</item><item>
<link>http://jackxiang.com/post//#blogcomment</link>
<title><![CDATA[[评论] [实践用到]mysql coalesce的函数用法]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://jackxiang.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>