CNCEC_SUBQHSE_WUHUAN/DataBase/版本日志/SUBQHSE_V2025-10-24-xiaj.sql

29 lines
823 B
Transact-SQL

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