MySql创建临时表
原创
©著作权归作者所有:来自51CTO博客作者indigotang的原创作品,请联系作者获取转载授权,否则将追究法律责任
语法格式:
Create TEMPORARY table new_table_name (Select * from old_table_name);
例子:
CREATE TEMPORARY TABLE temp_sum_sorce (
SELECT EmpId,SUM(Sorce)SumSorce,EmpIdO
FROM t_emp_paper_relation
WHERE Sorce <> 0 AND PaperId IN(12,13,14)
GROUP BY EmpId,EmpIdO
);
Create TEMPORARY table temp_t_base_employee (Select * From t_base_employee);