begin
    adoquery2.Close;
    adoquery2.SQL.Text:='select productid,sum(number)as number from orders where shenhe=1 and jiaohuo=0 group by productid';
    adoquery2.Open;    while not adoquery2.eof do
        begin
            s:=adoquery2.Fields[0].asstring;
            t:=adoquery2.Fields[1].AsInteger;
             adoquery1.Edit;
             adoquery1.Post;
              adoquery1.SQL.Add('select productid,productname,'''' as xuqiu,number from products where productid=:p1');
              adoquery1.open;
             adoquery1.Parameters.ParamByName('p1').Value:=s;
              adoquery1.FieldByName('xuqiu').AsInteger:=t;
              adoquery2.Next;
        end;这运行了还是错。。