70 lines
1.8 KiB
Transact-SQL
70 lines
1.8 KiB
Transact-SQL
alter table [dbo].[Environmental_ArchitectureReport] drop column Quarters
|
|
GO
|
|
alter table [dbo].[Environmental_ArchitectureReport] add Month int null
|
|
GO
|
|
alter table [dbo].[Environmental_ProjectArchitectureReport] drop column Quarters
|
|
GO
|
|
alter table [dbo].[Environmental_ProjectArchitectureReport] add Month int null
|
|
GO
|
|
|
|
/*************建筑行业能源节约与生态环境保护汇总表**************/
|
|
ALTER VIEW [dbo].[View_Environmental_ArchitectureReport]
|
|
AS
|
|
SELECT
|
|
Report.ArchitectureReportId,
|
|
Report.UnitId,
|
|
Report.FillingDate,
|
|
(ISNULL(Group_0008.ConstText,'-') + ISNULL(Group_0009.ConstText,'-')) AS ReportDate,
|
|
Group_0008.ConstText as YearStr,
|
|
Group_0009.ConstText as MonthStr,
|
|
U.UnitName,
|
|
Report.Year,
|
|
Report.Month,
|
|
Report.UpState,
|
|
Report.DutyPerson
|
|
FROM dbo.Environmental_ArchitectureReport AS Report
|
|
LEFT JOIN Base_Unit AS U ON U.UnitId=Report.UnitId
|
|
LEFT JOIN Sys_Const AS Group_0008 ON Group_0008.GroupId='0008' AND Group_0008.ConstValue =Report.[Year]
|
|
LEFT JOIN Sys_Const AS Group_0009 ON Group_0009.GroupId='0009' AND Group_0009.ConstValue =Report.[Month]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GO
|
|
|
|
|
|
|
|
/*************建筑行业能源节约与生态环境保护汇总表**************/
|
|
ALTER VIEW [dbo].[View_Environmental_ProjectArchitectureReport]
|
|
AS
|
|
SELECT
|
|
Report.ArchitectureReportId,
|
|
Report.ProjectId,
|
|
Report.FillingDate,
|
|
(ISNULL(Group_0008.ConstText,'-') + ISNULL(Group_0009.ConstText,'-')) AS ReportDate,
|
|
Group_0008.ConstText as YearStr,
|
|
Group_0009.ConstText as MonthStr,
|
|
U.ProjectName,
|
|
Report.Year,
|
|
Report.Month,
|
|
Report.UpState,
|
|
Report.DutyPerson
|
|
FROM dbo.Environmental_ProjectArchitectureReport AS Report
|
|
LEFT JOIN Base_Project AS U ON U.ProjectId=Report.ProjectId
|
|
LEFT JOIN Sys_Const AS Group_0008 ON Group_0008.GroupId='0008' AND Group_0008.ConstValue =Report.[Year]
|
|
LEFT JOIN Sys_Const AS Group_0009 ON Group_0009.GroupId='0009' AND Group_0009.ConstValue =Report.[Month]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GO
|
|
|
|
|