if exists(select 1 from sys.views V inner join sys.[schemas] S on  v.schema_id = s.schema_id where s.name='IES' and v.name = 'V_SCHET_SLUCH_LPU_1' and v.type = 'V')
    DROP VIEW [IES].[V_SCHET_SLUCH_LPU_1]
GO

CREATE VIEW [IES].[V_SCHET_SLUCH_LPU_1]
AS
    select ss.SchetSluchID, fs.F033SpmoID F033Spmo
    from IES.T_SCHET_SLUCH ss
        join IES.T_F033_SPMO fs on fs.IDSPMO = ss.LPU_1
    where fs.Actual = 1
GO
