【问题标题】:Tempory Table doesn't exist error临时表不存在错误
【发布时间】:2016-12-12 13:31:22
【问题描述】:

我使用 node js express 在 mysql 中创建了一个临时表

var table_name = "table"+(+new Date());
var query = "create temporary table "+table_name+" "+select_query

当我运行此代码时,我会在控制台中得到结果

result of creating temp table OkPacket {
  fieldCount: 0,
  affectedRows: 1640,
  insertId: 0,
  serverStatus: 34,
  warningCount: 0,
  message: ')Records: 1640  Duplicates: 0  Warnings: 0',
  protocol41: true,
  changedRows: 0 }

但是当我尝试从这个表中选择数据时,mysql 给出了表不存在的错误。

我无法弄清楚这个错误背后的原因。

请帮忙解决这个问题。

谢谢。

【问题讨论】:

    标签: mysql node.js temp-tables


    【解决方案1】:

    找了很久才找到答案here

    临时表仅在连接期间存在。如果您使用一个查询创建它,然后在新连接上执行单独的查询,它已经消失了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-06-22
      • 1970-01-01
      • 1970-01-01
      • 2022-01-16
      • 1970-01-01
      • 2015-10-05
      • 2014-05-03
      相关资源
      最近更新 更多