我想以destinEmpNo字段内容汇总Actualmoney字段内容。
请指教,多谢。。

解决方案 »

  1.   

    对了,上表是由表destine和incomebill两个表汇总得到。
      

  2.   

    select DestineEmpNo, sum(ActualMoney) from (select * from destine join incomebill on destine.billno = incomebill.billno
    where destine.billno is not null and destine.billno >= '200806010001' and destine.billno<'200807010001') t
    group by DestineEmpNo
      

  3.   

    服务器: 消息 263,级别 16,状态 1,行 1
    必须指定要从中选择的表。
    服务器: 消息 8156,级别 16,状态 1,行 8
    多次为 't' 指定了列 'RoomNo'。ydage 我运行你的语句后,出现上面的错误,
    注:我汇总的两个表destine和incomebill两个表中同名的列billno和roomno.
      

  4.   

    select DestineEmpNo, sum(ActualMoney) from (select destine.DestineEmpNo DestineEmpNo ,destine.ActualMoney ActualMoney from destine join incomebill on destine.billno = incomebill.billno
    where destine.billno is not null and destine.billno >= '200806010001' and destine.billno <'200807010001') t
    group by DestineEmpNo