insert into tb_Data_'+inttostr(i)+'_5 select * from tb_Data_'+inttostr(i)+'_4'+ ' where batchName='+Quoteds(CurrBatchName)+' and PicName='+Quotedstr(sPicName)
就像这样算伪码吧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;
从一个表里筛选出部分记录插入到有相同数据数据结构的另外一个表中
-------------------------------
需多多看书
batchName='+Quoteds(CurrBatchName)+'
和PicName='+Quotedstr(sPicName)
的所有记录导入到 tb_Data_'+inttostr(i)+'_5 中
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;