select '价格' from 表名 where 价格..
into ...新表

解决方案 »

  1.   

    试试如下方法:{利用两个QUERY组键进行操作};
    var
    mystring:tstringlist;
    i:integer;
    begin
    try
    mystring:=tstringlist.create;
    query.close;
    query.sql.text:='select '价格' from 表名';
    query.open;
    if query.recordcount>0 then
    begin
    query.first;
    while not query.eof do
    begin
    mystring.add(query.fieldbyname('价格').asstring);
    query.next;
    end;
    end;
    query1.close;
    query1.cachedupdates:=true;
    query1.requestlive:=true;
    query1.sql.text:='select {另一个表的字段} from {另一个表}';
    query1.open;
    if query.recordcount=query1.recordcount then//判断是否记录数一致
    begin
    for i:=0 to query1.recordcount-1 do
    begin
    query1.insert;
    query1.fieldbyname({另一个表的字段}).asstring:=mystring.items[i];
    query1.post;
    end;
    end
    else
    begin
    showmessage('记录数不等.')
    exit;
    end;
    finally
    mystring.free;
    end;
    end;