How can I create a subquery and use it in join?
I want to create SQL query as follows:
select *
from vwOrderRNI orni
left join vwOrderRN orn on orn.SysId in
(
select associatingid
from OrderRNAssociation
where AssociatedId = orni.SysId
and AssociationName = 'ORNItems'
)
left join vwPOrder po on po.SysId in
(
select AssociatingId
from PurchaseOAssociation
where AssociatedId = orn.SysId
and AssociationName = 'PO_OrderRequisitionNotes'
)
left join vwPOItem poi on poi.POrder =
(
-- above left join i want to take po.SysId which is filter because of
left join
)
How can I make 2nd left join in alias table so that I can use that in 3rd
left join?
No comments:
Post a Comment