ALTER VIEW [dbo].[View_MonthReport_InspectionManagement] AS /************Ô±¨È¡Êý************/ select im.InspectionId, im.ProjectId, im.CNProfessionalId, im.IsOnceQualified, im.InspectionDate, im.CompileDate, im.UnitId, detail.UnitWorkId from ProcessControl_InspectionManagement as im left join (select distinct(InspectionId),UnitWorkId from ProcessControl_InspectionManagementDetail) as detail on detail.InspectionId = im.InspectionId GO update ProcessControl_InspectionManagement set IsOnceQualified=1,InspectionDate=DATEADD(day,1,CompileDate) where InspectionDate is null and IsOnceQualified is null and CompileDate<'2025-10-01' GO update ProcessControl_InspectionManagement set InspectionDate=DATEADD(day,1,CompileDate) where InspectionDate is null and IsOnceQualified is not null and CompileDate<'2025-10-01' GO