有两个表,一个表里有一个字段,求出这来个字段的总和怎么求?  string heji = "select sum( B_aggregate) as sumagg from B_ABinfo ";
  string heji1 = "select sum( YB_aggregate) as sumagg from YB_ABinfo ";我怎么给他们都加起来 或者还有其他的办法

解决方案 »

  1.   

    select sum(sumagg) from
    )
    select B_aggregate as sumagg from B_ABinfo 
    union all
    select YB_aggregate as sumagg from YB_ABinfo
    )aa
      

  2.   

    你要是和用一条sql语句搞定,那是不可能的,
    你只有从数据库中把两个字段值读取出来,赋值到变量,然后相加.
      

  3.   

    select sum(sumagg) from
    (--错了这个括号
    select B_aggregate as sumagg from B_ABinfo 
    union all
    select YB_aggregate as sumagg from YB_ABinfo
    )aa
      

  4.   

    select sum(sumagg) from
    (
    select B_aggregate as sumagg from B_ABinfo 
    union all
    select YB_aggregate as sumagg from YB_ABinfo
    )aa
      

  5.   

    Label2.Text +Label2.Text 两个label怎么相加???  值相加