58 lines
3.1 KiB
Transact-SQL
58 lines
3.1 KiB
Transact-SQL
|
|
ALTER VIEW [dbo].[View_QuantityManagement_WorkTeamStatistics]
|
|
AS
|
|
/********工程量整体及分类汇总表********/
|
|
|
|
select distinct C.ProjectId+','+(case when a.DrawingNo is not null then a.WorkSection else b.WorkSection end)+','+ProjectContent as Id, C.ProjectId,case when a.DrawingNo is not null then a.WorkSection else b.WorkSection end as WorkSection,ba.State,
|
|
ProjectContent,Unit,
|
|
case when a.DrawingNo is not null then ca.ProfessionalName else cb.ProfessionalName end as Major
|
|
from QuantityManagement_DayInput C
|
|
left join QuantityManagement_Base ba on ba.BaseId=C.BaseId
|
|
left join QuantityManagement_Drawing a on a.DrawingId=ba.DrawingId
|
|
left join Base_CNProfessional ca on ca.CNProfessionalId=a.Major
|
|
left join QuantityManagement_Change b on b.ChangeId=ba.DrawingId
|
|
left join Base_CNProfessional cb on cb.CNProfessionalId=b.Major
|
|
union
|
|
select C.ProjectId+','+(case when a.DrawingNo is not null then a.WorkSection else b.WorkSection end)+','+ProjectContent as Id,C.ProjectId,case when a.DrawingNo is not null then a.WorkSection else b.WorkSection end as WorkSection,C.State,
|
|
ProjectContent,Unit,
|
|
case when a.DrawingNo is not null then ca.ProfessionalName else cb.ProfessionalName end as Major
|
|
from QuantityManagement_Base C
|
|
left join QuantityManagement_Drawing a on a.DrawingId=C.DrawingId
|
|
left join Base_CNProfessional ca on ca.CNProfessionalId=a.Major
|
|
left join QuantityManagement_Change b on b.ChangeId=C.DrawingId
|
|
left join Base_CNProfessional cb on cb.CNProfessionalId=b.Major
|
|
|
|
|
|
|
|
|
|
GO
|
|
|
|
|
|
|
|
ALTER VIEW [dbo].[View_QuantityManagement_ProjectContentStatistics]
|
|
AS
|
|
/********工程量整体及分类汇总表********/
|
|
|
|
select distinct C.ProjectId+','+ProjectContent as Id, C.ProjectId,ba.State,
|
|
ProjectContent,Unit,case when a.DrawingNo is not null then ca.ProfessionalName else cb.ProfessionalName end as Major
|
|
from QuantityManagement_DayInput C
|
|
left join QuantityManagement_Base ba on ba.BaseId=C.BaseId
|
|
left join QuantityManagement_Drawing a on a.DrawingId=ba.DrawingId
|
|
left join Base_CNProfessional ca on ca.CNProfessionalId=a.Major
|
|
left join QuantityManagement_Change b on b.ChangeId=ba.DrawingId
|
|
left join Base_CNProfessional cb on cb.CNProfessionalId=b.Major
|
|
union
|
|
select C.ProjectId+','+ProjectContent as Id,C.ProjectId,C.State,
|
|
ProjectContent,Unit,case when a.DrawingNo is not null then ca.ProfessionalName else cb.ProfessionalName end as Major
|
|
from QuantityManagement_Base C
|
|
left join QuantityManagement_Drawing a on a.DrawingId=C.DrawingId
|
|
left join Base_CNProfessional ca on ca.CNProfessionalId=a.Major
|
|
left join QuantityManagement_Change b on b.ChangeId=C.DrawingId
|
|
left join Base_CNProfessional cb on cb.CNProfessionalId=b.Major
|
|
|
|
|
|
|
|
GO
|
|
|
|
|