在查询的表中,数据表中两个列求和,求积,求百分比是怎么实现的,谢谢!

解决方案 »

  1.   

    不是很明白楼主的要求:是这个吗?
    select t1+t2 as sum_t1_t2 from test ; //求和
    select t1*t2 as mul_t1_t2 from test ; //求和
    select t1/t2*100 as per_t1_t2 from test ; //求百分比
      

  2.   

    listitem:=apart_LIST.Items.Add ;
          listitem.Caption :=recordset_temp.Fields[1].AsString ;
          listitem.ImageIndex :=0;
          recordset_temp2.SQL.Clear ;
          recordset_temp2.SQL.Add('select [CUSTOM_ID] from [CUSTOM] where [CUSTOM_AREA]=' + inttostr(recordset_temp.Fields[0].asinteger));
          recordset_temp2.Open ;
          listitem.SubItems.Add(inttostr(recordset_temp2.recordcount));
          listitem.SubItems.Add(format( '%8.2f%',[recordset_temp2.recordcount*100/customcount]));
          recordset_temp2.Close ;
          new(p);
          p^ := recordset_temp.Fields[0].AsInteger ;
          listitem.Data :=p;
          recordset_temp.Next;
    这段代码求百分比吧,帮我解释下好不,recordset_temp2为ADOQuery