select LOT_CMF_2, LOT_CMF_5, LOT_CMF_1, TRAN_TIME, 'D/B_WIP' as type,D/B_WIP as value
from table
where D/B_WIP is not null
union all
select LOT_CMF_2, LOT_CMF_5, LOT_CMF_1, TRAN_TIME, 'W/B_WIP' as type,W/B_WIP as value
from table
where W/B_WIP is not null
union all
select LOT_CMF_2, LOT_CMF_5, LOT_CMF_1, TRAN_TIME, 'Mold_WIP' as type,Mold_WIP as value
from table
where Mold_WIP is not null
以此类推
按照上面的sql进行取数