select
* --列转行只能写 * ,不能写字段
from
(select
T1.budge_type
,T1.year_month --期间
,T1.base_id --基地代码
,T1.base_nm --基地名称
,T1.cost_center_code --成本中心代码
,T1.cost_center_des --成本中心描述
,T1.product_type --产品
,T1.yield_val --产量
,T1.loop_line as 环形线 --环形线
,T1.line_val as 金刚线 --金刚线
,T1.main_val as 主轴轮 --主轴轮
,T1.pulley_jacket as 滑轮外套 --滑轮外套
,T1.fine_wheel_val as 精磨砂轮 --精磨砂轮
,T1.grinding_wheel_val as 削磨砂轮 --削磨砂轮
,T1.labor_protect_val as 劳保 --劳保
,T1.packag_material_val as 包材费用 --包材费用
,T1.other_val as 其他 --其他
,T1.equipment_val as 设备备件 --设备备件
,T1.public_share_val as 公摊费 --公摊费
,T1.office_expenses_val as 办公费等 --办公费等
,T1.direct_labor_val as 直接人工 --直接人工
,T1.indirect_labor_val as 间接人工 --间接人工
,T1.electric_val as 电费 --电费
,T1.water_val as 水费 --水费
,T1.depreciation_val as 折旧费 --折旧费
from jks_fds.t_bi_cut_cost_budge_target T1 --切方成本-04预算目标导入表
where T1.year_month = to_char(V_END_DATE,'yyyymm')
) T1
unpivot (rolling_cost_item_amt for cost_item_nm in(环形线,金刚线,主轴轮,滑轮外套,精磨砂轮,削磨砂轮,劳保,包材费用,其他,设备备件,公摊费,办公费等,直接人工,间接人工,电费,水费,折旧费)
Oracle行转列写法
最新推荐文章于 2024-07-09 17:22:14 发布