USE [befri_Goldhoo]
GO

/****** Object:  View [clearance].[V_SalesItem]    Script Date: 2020/12/9 15:57:31 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

ALTER VIEW [clearance].[V_SalesItem]
AS
SELECT  a.ItemType, a.ItemId, a.ItemNumber, a.ItemName, a.AliasName, a.Spec, a.CostPrice, a.SalesPrice, a.SearchCode, 
                   a.InventoryCategoryId, a.CategoryNumber, a.CategoryName, a.DisplayOrder, a.MasterImageUrl, a.IsCustomizable, 
                   a.Added, a.Status, a.ZHInvName, a.ZHInvNumber, a.DZInvName, a.DZInvNumber, a.HandledUrl, a.IsClearance, 
                   b.WarehouseId, b.Quantity AS InventoryAcc, b.DiscountCoef, ii.Introduction, a.DeliveryCycle, a.DeliveryCycleStr, a.ProductionProperty, a.ProductionPropertyText
FROM      shop_order.V_SalesItem AS a INNER JOIN
                   clearance.ClearanceAcc AS b ON a.IsClearance = 1 AND a.ItemId = b.InventoryId AND b.Quantity > 0 LEFT OUTER JOIN
                   basedata.InventoryIntro AS ii ON a.ItemId = ii.InventoryId

GO


