[步骤]
(@CustomerID int,@OrderSourceID int,@LastUpdateTime datetime,@endTime datetime) update dd set dd.IsOffShelf=cc.IsOffShelf from RB_Product_OrderSourceSKU dd inner join (select distinct a.CustomerID,a.OrderSourceID,a.OrderSourceSKU,case when b.OnlineState=1 then 0 else 1 end IsOffShelf from RB_Ebay_Listing_Product_V2 a (nolock) inner join RB_Ebay_Listing_Basic_V2 b (nolock) on a.ListingBasicID=a.ListingBasicID and a.CustomerID=b.CustomerID AND a.OrdersourceID=B.Ordersourceid and a.SiteCode=b.Sitecode where b.UpdateTime>@LastUpdateTime and b.UpdateTime<@endTime and a.CustomerID=@CustomerID and a.OrderSourceID=@OrderSourceID and isnull(a.OrderSourceSku,'')<>'') cc on dd.CustomerID=cc.CustomerID and dd.OrderSourceID=cc.OrderSourceID and dd.OrderSourceSKU=cc.OrderSourc
其中 包含 inner join RB_Ebay_Listing_Basic_V2 b (nolock) on a.ListingBasicID=a.ListingBasicID 应该是 inner join RB_Ebay_Listing_Basic_V2 b (nolock) on a.ListingBasicID=b.ListingBasicID
[结果]
[期望]
SQL 书写关联错误
