--查询到 pac_period_id 期间
select pac_period_id  from 
(
select cpp.pac_period_id,cpp.period_name
  from cst_pac_periods cpp
 where cpp.legal_entity = 102      
 order by  cpp.pac_period_id  desc)
 where rownum=1 ;  --查询到material_id,material_price物料编码和价格
 select tpam.material_id
      ,tpam.material_price
  from tg_purchase_acc_materials tpam
 where tpam.material_desc = '银'
   and tpam.status = 'Active';
-- status  ENTRY  状态情况如何把这四个字段汇集到一张表中,形成一行数据   
 

解决方案 »

  1.   

    --查询到 pac_period_id 期间
    select pac_period_id from  
    (
    select cpp.pac_period_id,cpp.period_name
      from cst_pac_periods cpp
     where cpp.legal_entity = 102   
     order by cpp.pac_period_id desc)
     where rownum=1 ;  union all --查询到material_id,material_price物料编码和价格
     select tpam.material_id
      ,tpam.material_price
      from tg_purchase_acc_materials tpam
     where tpam.material_desc = '银'
      and tpam.status = 'Active';
    -- status ENTRY 状态情况 
      

  2.   

    需要用空列和UNION ALL,没有关键项关联,不能合并行。LIKE
    select 1, null 2, null 3 
    from t1
    union all
    select null 1, 2, 3
    from t2
      

  3.   

    当然如果两个结果集都只有一行,你可以使用上面合并后的结果集用SUM或MAX得到一行数据。
      

  4.   

    但这里不能使用sum或是Max,没有其他的方法吗