insert into table2
select count(*)
from table1
where.........

解决方案 »

  1.   

    谢谢以上两位的回复,可能我的问题没有说清楚:
    如果是多个域同时输入呢?
    例如:
    insert into table2(name,value)这两个域,其中name是一个常量,value是上面table1中的统计值,这时候该怎么做?
      

  2.   

    insert into table2 ( name, value)
     ( select '名字', count(*) from table1 )'名字'就是你说的那个name常量
      

  3.   

    insert into table2
    select 常量值,count(*)
    from table1
    where.........
      

  4.   

    DECLARE
       x number;
    begin
      select count(*) into x from test;
      insert into test values (x,5);
    end;
      

  5.   

    SQLWKS> desc test;
    列名                           空?     类型
    ------------------------------ -------- ----
    A                                       NUMBER
    B                                       NUMBER(3)
      

  6.   

    已经成功了,谢谢Lastdrop(空杯) 和各位