ITeye博客

mysql 临时表

chengwang · 2012-07-25 17:41 · 数据库 · Markdown

create TEMPORARY table temp1  (select * from heat_all c where UNIX_TIMESTAMP('2012-05-28 15:44:19')<=UNIX_TIMESTAMP(c.nowtime)  and UNIX_TIMESTAMP(c.nowtime)<=UNIX_TIMESTAMP('2012-05-28 16:44:55') and c.read_status = '1') 

创建临时表关键字 TEMPORARY 。 该表只存在当前连接,所以要确保查询该表时使用的connection与创建的connect是同一个,否则会出现No operations allowed after connection closed 错误。

使用临时表时,最好单独建立connection,记得使用完关闭该connection。

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。