MySQL创建临时表

时间:2015-05-05 04:33:57

标签: mysql

无法理解为什么这个创建临时表不起作用..谁能建议..?

create temporary table if not exists table2 AS (select unix_timestamp(concat(delivery_date, ' ', str_to_date(delivery_time,'%h:%i%p'))) as timestamp, id from fruit.order_delivery_orders where calendar_id is not null);

收到错误“查询中断”。

此查询正常 -

select unix_timestamp(concat(delivery_date, ' ', str_to_date(delivery_time,'%h:%i%p'))) as timestamp, id from fruit.order_delivery_orders where calendar_id is not null

1 个答案:

答案 0 :(得分:1)

请使用以下语法。愿这对你有所帮助。

 CREATE TABLE [ IF NOT EXISTS ] table_name AS SELECT column_names FROM table_name_2 WHERE condition;