本帖最后由 xynss 于 2017-5-2 16:55 编辑 我用以下SQL建报表的模板数据集: select distinct a.userid, a.username, a.useraddr, a.busitype, c.busitypename, to_char(a.createtime, 'yyyy-MM-dd') busiacceptime, to_char(a.endtime, 'yyyy-MM-dd') endtime, to_char(a.starttime, 'yyyy-MM-dd') starttime, a.mtdeptcode, a.mtoptcode, d.optname createuser, e.orgname, f.optname, b.*, to_char(nvl(fee.prefeprice, 0)) prefeprice from t_mms2_workorder a right join (select workorderpkid, mtcode, max(mtname) mtname, to_char(max(price)) price, max(unit) unit, to_char(sum(count)) count, to_char(sum(amount)) amount, max(createby) createby from t_mms2_material group by mtcode, workorderpkid) b on a.pkid = b.workorderpkid left join t_mms2_busitype c on a.BUSITYPE = c.busitype left join t_ms_operator d on b.createby = d.account left join t_ms_organization e on a.mtdeptcode = e.orgcode left join t_ms_operator f on f.account = a.mtoptcode left join (select fee.workorderpkid, max(fee.prefeprice) prefeprice, max(fee.totalprice) totalprice from t_mms2_mtfee fee where fee.feetype = 'GS005' group by fee.workorderpkid) fee on fee.workorderpkid = a.pkid; 预览数据时报这个错:(SQL在PL/SQL中是可以执行的) 请帮忙解决,谢谢! |
最佳回答 |
||||
0
|
|
|||
0
|
|
|||
0
|
|
|||
0
|
|
|||
0
|
|
|||
0
|
|