select T2.F_BuildName,sum(F_WarnValue) - sum(F_Value) F_Value from T_DC_UllimitWarnInfo T1,dbo.T_BD_BuildBaseInfo T2
where T1.F_BuildID=T2.F_BuildID and F_UpperLowerType=0 and F_Uint=3 and F_EnergyItemCode='02000'
and T1.F_BuildID in (select F_BuildID from dbo.T_BD_BuildPropertyInfo where F_AreaCode='{0}') and
T1.F_CreateTime >='{1}' and T1.F_CreateTime <= '{2}' group by T1.F_BuildID,T2.F_BuildName
create view 视图名称
as
(select T2.F_BuildName as 名称,sum(F_WarnValue) - sum(F_Value) F_Value as 值 from T_DC_UllimitWarnInfo T1,dbo.T_BD_BuildBaseInfo T2
where T1.F_BuildID=T2.F_BuildID and F_UpperLowerType=0 and F_Uint=3 and F_EnergyItemCode='02000'
and T1.F_BuildID in (select F_BuildID from dbo.T_BD_BuildPropertyInfo where F_AreaCode='{0}') and
T1.F_CreateTime >='{1}' and T1.F_CreateTime <= '{2}' group by T1.F_BuildID,T2.F_BuildName)