insert into  tb_Data_'+inttostr(i)+'_5 select * from  tb_Data_'+inttostr(i)+'_4'+ ' where batchName='+Quoteds(CurrBatchName)+' and PicName='+Quotedstr(sPicName)

解决方案 »

  1.   

    insert里面的select 语句怎么解释  
      

  2.   

    从一个查询结果集向表中批量insert数据
      

  3.   

    这个是某种数据库支持的批量插入数据,意思就是把Select出来的数据批量插入到表中,这个要求查询出来的数据和插入表的结构一样,而且顺序也需要一样。
      

  4.   

    你的sql语句是
    从一个表里筛选出部分记录插入到有相同数据数据结构的另外一个表中
    -------------------------------
    需多多看书
      

  5.   

    将tb_Data_'+inttostr(i)+'_4'表中符合
       batchName='+Quoteds(CurrBatchName)+'
     和PicName='+Quotedstr(sPicName)
     的所有记录导入到 tb_Data_'+inttostr(i)+'_5 中
      

  6.   

    select 是 查询出数据相当于一个临时数据集
      

  7.   

    select 是 查询出数据相当于一个临时数据集
      

  8.   

    就像这样算伪码吧with ADOQuery do
    begin 
      sql.clear;
      sql.add('select * from  tb_Data_'+inttostr(i)+'_4'+ ' where batchName='+Quoteds(CurrBatchName)+' and PicName='+Quotedstr(sPicName));
      open;
    end;while not ADOQuery do
    begin
      with ADOQuery2 do
      begin
        sql.clear;
        sql.add(insert into  tb_Data_'+inttostr(i)+'_5 );
        ExecSql;
      end;
      ADOQuery.next;
    end;