select 编号, 姓名, 年份,月份, 基本工资 + 奖金 as 实发工资
from table1

解决方案 »

  1.   

    编号     姓名       年份     月份     基本工资    奖金   
    1﹕
    select max(编号)﹐max(姓名)﹐年份+'-'+right(cast(100+cast(月份 as int) as varchar),2) as 年月份,
    sum(基本工资)+sum(奖金) as 实发工资
    from tablename
    group by 年份+'-'+right(cast(100+cast(月份 as int) as varchar),2)
    2﹕
    select max(编号)﹐max(姓名)﹐年份﹐月份﹐sum(基本工资)+sum(奖金) as 实发工资
    from tablename
    group by 年份﹐月份
      

  2.   


    或select max(编号), 姓名, 年份,月份, sum(基本工资 + 奖金 )as 实发工资
    from table1 group by 姓名,月份, 年份
      

  3.   

    select 编号, 姓名, 年份,月份, sum(基本工资 + 奖金 ) as  实发工资
          from table1
          group by   编号,年份, 月份