如何从SQL查询的结果创建表? [英] How to create a table from the results of a SQL query?

查看:556
本文介绍了如何从SQL查询的结果创建表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将查询结果放入未创建的表中?

How can I put the results of a query into a table which is NOT created?

例如,将以下查询结果放入新表中 EmployeeDetail ,它不创建。创建表格并同时输入结果。

For example, put the following query results into a new table EmployeeDetail which IS NOT CREATED. Create the table and put the results at the same time.

select a.Name, b.Id
from Database1 a left join 
     Database2 b
ON a.Id = b.Id

推荐答案

您没有指定RDBMS系统,但在SQL Server中, / p>

You didn't specify your RDBMS system, but in SQL Server it would be like this

select a.Name, b.Id into EmployeeDetail 
from Database1 a left join Database2 b ON a.Id = b.Id

这篇关于如何从SQL查询的结果创建表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆