[转]mysql临时表功能

<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>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值