0

如何结合输出值。我的查询低于It.Finance...假设高、中和低下的 3 个值..我想将中低结合在一起作为平均值,这意味着我的输出值可能是

高的

平均(中低)

select  count(h.Dept_id) as DeptCount,

i.Id as CompanyId,

i.Account as AccountTotal,

i.Technology as IT,

ISNULL(it.Finance,'NoCapacity') as School

from Institution i left join 

 History h on h.Institution_id = i.Id left join 

   xxxxx

   yyyyy      

group by i.Id,i.Account,i.Technology,it.Finance

是否可以?

4

1 回答 1

0

最佳盲猜:

select  count(h.Dept_id) as DeptCount,
i.Id as CompanyId,
i.Account as AccountTotal,
i.Technology as IT,
coalesce(it.Finance,'NoCapacity') as School,
Max(it.Finance) as High, 
(Avg(it.Finance) + Min(it.Finance))/2 as Average
from Institution i left join 
History h on h.Institution_id = i.Id left join 
   xxxxx -- your unknown tables
   yyyyy -- your unknown tables     
group by i.Id, i.Account
于 2013-01-14T23:21:13.170 回答