去除列名重复

 

select rtrim(ltrim(a.Bank)) as Country, count(*) as Total
from T_BASE_OWNER a left join
T_BASE_COMPANY b on a.CompanyID= b.ID
left join T_BASE_BUILD c on b.BuildID=c.ID
where c.Level=2 and a.OwnerType=1
and a.Bank is not NULL and a.Bank != ''
group by rtrim(ltrim(a.Bank))


select w.Country as Country,count(*) as Total from
(select rtrim(ltrim(a.Bank)) as Country from T_BASE_OWNER a left join
T_BASE_COMPANY b on a.CompanyID= b.ID
left join T_BASE_BUILD c on b.BuildID=c.ID
where c.Level=2 and a.OwnerType=1
and a.Bank is not NULL and a.Bank != '' ) w group by w.Country

相关文章:

  • 2021-05-11
  • 2021-05-22
  • 2022-02-25
  • 2021-05-30
  • 2022-12-23
  • 2021-11-25
  • 2021-09-11
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-07-03
  • 2021-10-01
  • 2022-01-27
  • 2022-12-23
  • 2021-12-05
相关资源
相似解决方案