本文介绍了当我在查询加入中使用外部应用代替左连接时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友们,



我可以用OUTER APPLY代替Left Join



代码如下:



Hi Friends,

where i can use OUTER APPLY in place of Left Join

some code as below:

OUTER APPLY
  (
      SELECT IPO.PurchaseOrderID,ISTN.STNID FROM InvoicePurchaseOrder IPO  (NOLOCK)
      LEFT JOIN InvoiceSTN ISTN  (NOLOCK) ON IPO.InvoiceID=ISTN.InvoiceID  WHERE SRPO.PurchaseOrderID=IPO.PurchaseOrderID
      UNION ALL
      SELECT SPO.PurchaseOrderID,SPO.STNID FROM STNPurchaseOrder(NOLOCK) SPO WHERE SPO.PurchaseOrderID=SRPO.PurchaseOrderID
   )  STPP  --ON SRPO.PurchaseOrderID=stpp.PurchaseOrderID







我已将其替换为






I REPLACED IT IN PLACE OF

LEFT JOIN 
  (
      SELECT IPO.PurchaseOrderID,ISTN.STNID FROM InvoicePurchaseOrder IPO  (NOLOCK)
      LEFT JOIN InvoiceSTN ISTN  (NOLOCK) ON IPO.InvoiceID=ISTN.InvoiceID  WHERE SRPO.PurchaseOrderID=IPO.PurchaseOrderID
      UNION ALL
      SELECT SPO.PurchaseOrderID,SPO.STNID FROM STNPurchaseOrder(NOLOCK) SPO 
   )  STPP  ON SRPO.PurchaseOrderID=stpp.PurchaseOrderID





请帮助我!!!



谢谢

SHREENIWAS

推荐答案


这篇关于当我在查询加入中使用外部应用代替左连接时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-25 09:55