SQL语句为,
select sum(count), sum(length), sum(hd_count), sum(hd_length), sum(city_count), sum(city_length)
from (
SELECT
count(*) as count,
sum(length) as length,
case when roadclass < 3 then count(*) else 0 end as "hd_count",
case when roadclass < 3 then sum(length) else 0 end as "hd_length",
case when roadclass >= 3 then count(*) else 0 end as "city_count",
case when roadclass >= 3 then sum(length) else 0 end as "city_length"
FROM BD_CHA group by roadclass
)
结果为,