先列转行处理啊
外面在套一层就行了
------------------参考
with A as (
select YEAR,1 as Month_Column,Jan_value as value from factorypresetsproduction
union all
select YEAR,2 as Month_Column,feb_value as value from factorypresetsproduction
union all
select YEAR,3 as Month_Column,mar_value as value from factorypresetsproduction
union all
select YEAR,4 as Month_Column,apr_value as value from factorypresetsproduction
union all
select YEAR,5 as Month_Column,may_value as value from factorypresetsproduction
union all
select YEAR,6 as Month_Column,jun_value as value from factorypresetsproduction
union all
select YEAR,7 as Month_Column,api_value as value from factorypresetsproduction
union all
select YEAR,8 as Month_Column,aug_value as value from factorypresetsproduction
union all
select YEAR,9 as Month_Column,sep_value as value from factorypresetsproduction
union all
select YEAR,10 as Month_Column,oct_value as value from factorypresetsproduction
union all
select YEAR,11 as Month_Column,nov_value as value from factorypresetsproduction
union all
select YEAR,12 as Month_Column,dev_value as value from factorypresetsproduction)
select * from A where YEAR = "2024" and Month_Column BETWEEN 1 AND 8;