如何在临时表中保存选择查询结果? [英] How to save select query results within temporary table?

查看:23
本文介绍了如何在临时表中保存选择查询结果?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将选择查询输出保存到临时表中.然后我需要对这个临时表进行另一个选择查询.有人知道怎么做吗?

I need to save select query output into temporary table. Then I need to make another select query against this temporary table. Does anybody know how to do it?

我需要在 SQL Server 上做这个.

I need to make this on SQL Server.

推荐答案

您还可以执行以下操作:

You can also do the following:

CREATE TABLE #TEMPTABLE
(
    Column1 type1,
    Column2 type2,
    Column3 type3
)

INSERT INTO #TEMPTABLE
SELECT ...

SELECT *
FROM #TEMPTABLE ...

DROP TABLE #TEMPTABLE

这篇关于如何在临时表中保存选择查询结果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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