oww sori gw revisi lagi..

select
number as numbers,
total_onnet as onnet,
total_offnet as offnet,
total_international as international,
total_onnet+total_offnet+total_international as TOTAL

from(
select
number,
sum((case when jenis=1 then total else 0 end))total_onnet,
sum((case when jenis=2 then total else 0 end)) total_offnet,
sum((case when jenis=3 then total else 0 end)) total_international

from(
select number,total, 1 as jenis from t_onnet
union all
select number,total, 2 as jenis from t_offnet
union all
select number,total, 3 as jenis from t_international
) x
group by number
) y


On Tue, Jun 8, 2010 at 1:19 PM, wendi gunawan <[email protected]>wrote:

> select
> number as numbers,
> total_onnet as onnet,
> total_offnet as offnet,
> total_international as international,
> total_onnet+total_offnet+total_international as TOTAL
>
> from(
> select
> number,
> sum((case when jenis=1 then total else 0 end))total_onnet,
> sum((case when jenis=2 then total else 0 end)) total_offnet,
> sum((case when jenis=3 then total else 0 end)) total_international
>
> from(
>
> select number,count(*) total, 1 as jenis from t_onnet
> group by number
> union all
> select number,count(*) total, 2 as jenis t_offnet
> group by number
> union all
> select number,count(*) total, 3 as jenis t_international
> group by number
> ) x
> group by number
> ) y
>
>
> moga membantu
>
> On Tue, Jun 8, 2010 at 11:34 AM, romy <[email protected]> wrote:
>
>>
>>
>> Dear Master,
>>
>> Need help to compare 3 tables in oracle
>>
>> Example like this :
>>
>> 3 tables are :
>> 1. onnet
>> 2. offnet
>> 3. international
>>
>> each files, contains like below :
>>
>> 5 628970215721
>> 3 628970502888
>> 2 628970726183
>> 1 628970734887
>>
>> ..........
>>
>> first column are total, last column are numbers
>>
>> Now we would like to have result like below
>>
>> Numbers onnet offnet international total
>> 628970215721 5 1 2 8
>> 628970502888 3 13 2 18
>> 628970726183 2 14 3 19
>> 628970734887 1 14 4 19
>>
>> Please advice,
>>
>> Thank you.
>> Best regards,
>> Romy
>>
>> [Non-text portions of this message have been removed]
>>
>>  
>>
>
>
>
> --
> wendi gunawan
> Java Software Developer & penulis (new bie)
> terus belajar untuk tidak cinta dunia
> http://oretanwendi.wordpress.com/
> hp:085624046906
>
>


-- 
wendi gunawan
Java Software Developer & penulis (new bie)
terus belajar untuk tidak cinta dunia
http://oretanwendi.wordpress.com/
hp:085624046906


[Non-text portions of this message have been removed]

Kirim email ke