How to save select query results within temporary table?

后端 未结 3 756
天命终不由人
天命终不由人 2020-12-15 15:42

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?

I nee

相关标签:
3条回答
  • 2020-12-15 15:55

    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
    
    0 讨论(0)
  • 2020-12-15 16:00
    select *
    into #TempTable
    from SomeTale
    
    select *
    from #TempTable
    
    0 讨论(0)
  • 2020-12-15 16:08

    In Sqlite:

    CREATE TABLE T AS
    SELECT * FROM ...;
    -- Use temporary table `T`
    DROP TABLE T;
    
    0 讨论(0)
提交回复
热议问题