<p>本文转自:<font>http://www.lupaworld.com/30912/viewspace_24024.html</font></p><p>原文如下:</p><p><font>本来以为mysql没有sqlserver的with类似的功能</font></p><p><font>不过后来在myql的参考手册的一个小小的旮旯窝里发现了少的那么几条的临时的建立和使用方法</font></p><p><font>create temporary table tmp ( <br>article int(4) unsigned zerofill default '0000' not null, <br>price double(16,2) default '0.00' not null);</font></p><p><font>lock tables article read;</font></p><p><font>insert into tmp select article, max(price) from shop group by article;<br>select article, dealer, price from shop, tmpwhere shop.article=tmp.articel and shop.price=tmp.price;</font></p><p><font>unlock tables;</font></p><p><font>drop table tmp;<br>除了草草几个字,连具体的说明也没,没想法啊,<br>不过还好,看懂能用就行不过有了它,很多地方的操作也就方便多了,只是不知道这对数据库的服务端资源的消耗情况</font></p>
[转]mysql临时表功能
最新推荐文章于 2021-02-17 21:24:19 发布