我想把第一次查询的结果存放在一张临时表中然后对这张表进行第二次查询,如何实

解决方案 »

  1.   

    select * into # from ......select * from # ...
      

  2.   

    select * into #t from tb
    select * from #t 
      

  3.   

    select * from (select * from 表A) a
      

  4.   

    --将所得数据插入临时表
    select * into #temp from table1--读取#temp表中内容
    select * from #temp--做完操作后可删除临时表
    drop table #temp
      

  5.   

    临时表
    直接SELECT 。。 FROM  临时表名
      

  6.   


    不需要用临时表,还不如用子查询作为表再对表进行限制查询select * from
    (
    select * from tb
    where id>10
    ) aa
    where id>20这样查询的速度也快些