if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Vw_ARTSELECCIONADOS_CLUSTER]') and OBJECTPROPERTY(id, N'IsView') = 1)
drop view [dbo].[Vw_ARTSELECCIONADOS_CLUSTER]
GO

SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

CREATE VIEW dbo.Vw_ARTSELECCIONADOS_CLUSTER
AS
SELECT IN_INVENTPHISICAL.INVTIDSKU, IN_INVENTORY.DESCR, 
    IN_INVENTPHISICAL.CLASSUBID, 
    IN_INVENTPHISICAL.CLASSID, 
    IN_SUBCATEGORY.DESCR AS NSCAT, 
    IN_CATEGORY.DESCR AS NCAT, 
    IN_INVENTPHISICAL.STOCKPHISICAL, 
'' AS INVTIDBARR
--    IN_INVENTORYALTER.INVTIDBARR
FROM IN_INVENTPHISICAL INNER JOIN
    IN_INVENTORY ON 
    IN_INVENTPHISICAL.INVTIDSKU = IN_INVENTORY.INVTIDSKU INNER
     JOIN
    IN_SUBCATEGORY ON 
    IN_INVENTORY.CLASSUBID = IN_SUBCATEGORY.CLASSUBID AND
     IN_INVENTORY.CLASSID = IN_SUBCATEGORY.CLASSID INNER
     JOIN
    IN_CATEGORY ON 
    IN_SUBCATEGORY.CLASSID = IN_CATEGORY.CLASSID 
--LEFT OUTER  JOIN IN_INVENTORYALTER ON IN_INVENTORY.INVTIDSKU = IN_INVENTORYALTER.INVTIDSKU




GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

