下面这段SQL,with a as() 里面的是没有错误的,查询显示列名错误 with a as (..............) select a.GroupID, a.GroupName,a.groupseq, a.AreaID, a.AreaName,a.areaseq, a.CompanyID, a.CompanyName,a.companyseq, a.ProjectID, a.ProjectName,a.projectseq, a.BeginDate XMQDSJ, a.JHZJPHSJ, a.SJZJPHSJ, sum(a.DYKY) as DYKY, sum(a.DYBKY) as DYBKY, sum(a.SJJTZB) as SJJTZB, sum(a.NBGSJC) as NBGSJC, sum(a.QTJC) as QTJC, sum(a.LZCB) as LZCB, sum(a.LZFY) as LZFY, sum(a.LZLX) as LZLX, sum(a.QT) as QT, sum(a.JTZBTR) as JTZBZR, sum(a.NBGSJR) as NBGSJR, sum(a.RZLR) as RZLR, sum(a.QTJR) as QTJR, a.Remark, a.TDBZJSJ FROM a left join Authority_MY c on a.Groupid=c.authority_id where 1=1 ${if(fr_username='root',"and 1=1","and c.UserName = '" + fr_username + "'")} and xlxm IN ('${xlxm}') ${if(len(jt)=0,"and 1=1","and a.groupid in ('"+jt+"')")} and a.ProjectID <> '0C3891D4-1439-E711-80B9-6C0B84B83F14' group by GroupID,CompanyID,ProjectID order by groupseq,xlxm,areaseq,companyseq,projectseq |