|
|
发表于 2010/9/27 10:28:52
|
显示全部楼层
SELECT DECODE(t.rank_number, 1, t.vendor_name, '') vendor_name,
DECODE(t.rank_number, 1, t.segment1, '') material_num,
DECODE(t.rank_number, 1, t.description, '') description,
t.line_id,
t.header_id,
t.vendor_id,
t.material_name,
t.material_origin,
t.material_mark
FROM (SELECT a.line_id,
a.header_id,
a.vendor_id,
tpav.vendor_name,
a.inventory_item_id,
msiv.segment1,
msiv.description,
a.material_name,
a.material_origin,
a.material_mark,
RANK() OVER(PARTITION BY tpav.vendor_name, msiv.segment1, msiv.description
ORDER BY tpav.vendor_name, msiv.segment1, msiv.description) rank_number
FROM tg_purchase_acc_sj_line a,
tg_purchase_acc_vendors tpav,
mtl_system_items_vl msiv
WHERE a.vendor_id = tpav.vendor_id
AND msiv.inventory_item_id = a.inventory_item_id) t
|
|