Table
P_ID I_ID S_ID T_ID Column Column1
-- (<Column1> supposed to be <Column>.<Table>-<Column>.<Table1>)
Table
P_ID I_ID S_ID T_ID Column
我在源表上运行了这个查询:
select <column> from
<TABLE>
where
i_id='<value>';
我得到的输出为 9000 然后我在目标上运行这个查询来测试 id Column1 得到正确的值
select P_ID, I_ID, S_ID, T_ID,
sum(<column>)
from
<TABLE> F,<TABLE2> PO
where
F.P_ID = PO.P_ID
and F.I_ID=PO.I_ID
and F.FLAG='Y' --something that we need
and T_id>='2012001' --just for results for 2012
and F.I_id='<Value>'
group by F.P_ID, F.I_ID, F.S_ID, F.T_ID
order by 1;
Here i get Output as
P_ID I_ID S_ID T_ID sum(<column>)
<Value> <Value> <Value> <Value> 18000