ALTER VIEW [dbo].[View_HJGL_NoWeldJointFind] AS --δº¸º¸¿Ú²éÕÒ SELECT jot.WeldJointId, jot.WeldJointCode, cast((case when charindex('/',jot.WeldJointCode)>0 then (case when ISNUMERIC(RIGHT(jot.WeldJointCode,CHARINDEX('/',REVERSE(jot.WeldJointCode))-1))=1 then RIGHT(jot.WeldJointCode,CHARINDEX('/',REVERSE(jot.WeldJointCode))-1) else '1000' end) else '1000' end) as int) as WeldJointNum, (case when charindex('/',jot.WeldJointCode)>0 then RIGHT(jot.WeldJointCode,CHARINDEX('/',REVERSE(jot.WeldJointCode))-1) else jot.WeldJointCode end) as WeldJointNumStr, jot.PipelineId, jot.WeldingDailyId, jot.JointAttribute, jot.Dia, jot.DNDia, jot.Size, jot.Thickness, jot.Remark, WeldType.WeldTypeCode, method.WeldingMethodCode, rod.ConsumablesCode AS WeldingRodCode, wire.ConsumablesCode AS WeldingWireCode, mat1.MaterialCode AS Material1Code , mat2.MaterialCode AS Material2Code FROM dbo.HJGL_WeldJoint jot LEFT JOIN dbo.HJGL_PreWeldingDaily pre ON pre.WeldJointId = jot.WeldJointId LEFT JOIN Base_WeldType AS WeldType ON WeldType.WeldTypeId=jot.WeldTypeId LEFT JOIN Base_WeldingMethod AS method ON method.WeldingMethodId=jot.WeldingMethodId LEFT JOIN Base_Material AS mat1 ON mat1.MaterialId = jot.Material1Id LEFT JOIN Base_Material AS mat2 ON mat2.MaterialId = jot.Material2Id LEFT JOIN Base_Consumables AS wire ON wire.ConsumablesId=jot.WeldingWire LEFT JOIN Base_Consumables AS rod ON rod.ConsumablesId=jot.WeldingRod WHERE pre.PreWeldingDailyId IS NULL and jot.WeldJointId not in (select WeldJointId from HJGL_WeldJoint where IsTwoJoint = 1 and (AuditDate is null or AuditDate='')) GO