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
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
where destine.billno is not null and destine.billno >= '200806010001' and destine.billno<'200807010001') t
group by DestineEmpNo
必须指定要从中选择的表。
服务器: 消息 8156,级别 16,状态 1,行 8
多次为 't' 指定了列 'RoomNo'。ydage 我运行你的语句后,出现上面的错误,
注:我汇总的两个表destine和incomebill两个表中同名的列billno和roomno.
where destine.billno is not null and destine.billno >= '200806010001' and destine.billno <'200807010001') t
group by DestineEmpNo