<?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 select in 排序问题, 需要用find_in_set()]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[WEB2.0]]></category>
<pubDate>Tue, 17 Aug 2010 02:50:12 +0000</pubDate> 
<guid>http://jackxiang.com/post//</guid> 
<description>
<![CDATA[ 
	表结构如下:<br/>mysql&gt; select * from test;<br/>+----+-------+<br/>&#124; id &#124; name&nbsp;&nbsp;&#124;<br/>+----+-------+<br/>&#124;&nbsp;&nbsp;1 &#124; test1 &#124;<br/>&#124;&nbsp;&nbsp;2 &#124; test2 &#124;<br/>&#124;&nbsp;&nbsp;3 &#124; test3 &#124;<br/>&#124;&nbsp;&nbsp;4 &#124; test4 &#124;<br/>&#124;&nbsp;&nbsp;5 &#124; test5 &#124;<br/>+----+-------+<br/><br/>执行以下SQL:<br/>mysql&gt; select * from test where id in(3,1,5);<br/>+----+-------+<br/>&#124; id &#124; name&nbsp;&nbsp;&#124;<br/>+----+-------+<br/>&#124;&nbsp;&nbsp;1 &#124; test1 &#124;<br/>&#124;&nbsp;&nbsp;3 &#124; test3 &#124;<br/>&#124;&nbsp;&nbsp;5 &#124; test5 &#124;<br/>+----+-------+<br/>3 rows in set (0.00 sec)<br/><br/>这个select在mysql中得结果会自动按照id升序排列,<br/>但是我想执行&quot;select * from test where id in(3,1,5);&quot;的结果按照in中得条件排序,即:3,1,5,想得到的结果如下:<br/>id&nbsp;&nbsp; name<br/>3&nbsp;&nbsp;&nbsp;&nbsp;test3<br/>1&nbsp;&nbsp;&nbsp;&nbsp;test1<br/>5&nbsp;&nbsp;&nbsp;&nbsp;test5 <br/><br/><br/><br/><div class="code">mysql&gt; select * from Tbl_FQQ_FScoreCount where id in(3,1,5) order by find_in_set(id,&#039;3,1,5&#039;);&nbsp;&nbsp;&nbsp;&nbsp;<br/>+----+-----------+-------------+<br/>&#124; ID &#124; FQQ&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#124; FScoreCount &#124;<br/>+----+-----------+-------------+<br/>&#124;&nbsp;&nbsp;3 &#124; 715113297 &#124;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;40 &#124; <br/>&#124;&nbsp;&nbsp;1 &#124;&nbsp;&nbsp;78540474 &#124;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;37 &#124; <br/>&#124;&nbsp;&nbsp;5 &#124;&nbsp;&nbsp; 1735548 &#124;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0 &#124; <br/>+----+-----------+-------------+</div><br/><br/><br/>select id, name from table where &#039;daodao&#039; IN (list);<br/>IN (list);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;如果list是常量，则可以直接用IN，大家怎么看？&nbsp;&nbsp; <br/>
]]>
</description>
</item><item>
<link>http://jackxiang.com/post//#blogcomment</link>
<title><![CDATA[[评论] Mysql select in 排序问题, 需要用find_in_set()]]></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>