ASP列条件求和怎么写?

2024-12-27 03:16:07
推荐回答(2个)
回答1:

select BigClassName, sum (case BigClassName when '技术文章' then hits else null end) as 技术文章总量,sum (case BigClassName when '公司新闻' then hits else null end) as 公司新闻总量,sum (case BigClassName when '企业文化' then hits else null end) as 企业文化总量 from news group by BigClassName

回答2:

select sum(BigClassName) from news where BigClassName like '%技术文章%'
select sum(BigClassName) from news where BigClassName like '%公司新闻%'
select sum(BigClassName) from news where BigClassName like '%企业文化%'