- outer join
- 不能有group by 之類的group function(???後來我有另一個例子是OK)
select /*+ index(d) push_pred(b)*/
a.objek matnr,d.atbez,a.atwrt,a.atflv,b.atwtb ,a.atinn,c.msehi,c.atnam
from sap_ausp a
left join (select a.atinn,a.atwrt,b.atwtb
from sap_cawn a,sap_cawnt b
where a.atinn = b.atinn
and a.atzhl = b.atzhl
--group by a.atinn,a.atwrt,b.atwtb
) b on a.atinn = b.atinn and a.atwrt = b.atwrt
left join sap_cabn c on a.atinn = c.atinn
left join sap_cabnt d on a.atinn = d.atinn
where a.objek = r1.matnr
group by a.objek,d.atbez,a.atwrt,a.atflv,b.atwtb ,a.atinn,c.msehi,c.atnam
沒有留言:
張貼留言