Sebelumnya, terimakasih atas responnya,
Tadi sebelum tanya, sudah sempat coba queri ini, cuma hasilnya tidak sesuai,
misal :
table_1
data_uid amount
------------ -----------
3 5
3 14
table_2
data_uid amount
------------ -----------
3 5
dgn queri di bawah hasil amountnya = 9, sedang yg di inginkan : amount = 14
slm/Al
Ferry Setiawan <[EMAIL PROTECTED]> wrote:
select a.data_uid,sum(nvl(a.amount,0) - nvl(b.amount,0))
from table1 a,table2 b
where a.data_uid = b.data_uid
group by a.data_uid
regards
Ferry
2008/5/7, aly rmb <[EMAIL PROTECTED]>:
>
> Salam semuanya,
> TABLE_1
> DATA_UID AMOUNT
> --------------- ------------
> 1 4
> 1 3
> 2 20
>
> TABLE_2
> DATA_UID AMOUNT
> --------------- -------------
> 1 7
> 2 24
> Klo queri spt ini,
> select data_uid, sum(amount)
> from table_1 a
> group by data_uid
> having sum(amount) <> (select sum(amount)
> from table_2 b
> where b.data_uid = a.data_uid )
>
> hasilnya :
>
> DATA_UID AMOUNT
> --------------- -------------
> 2 20
> klo Amount yg di inginkan adalah selisih antara TABLE_1 dan TABLE_2,
> kira* querinya spt apa ya ? (amountnya = 4 bukan 20)
>
> slm/Aly
>
[Non-text portions of this message have been removed]
Send instant messages to your online friends http://uk.messenger.yahoo.com
[Non-text portions of this message have been removed]