SQL> drop table t purge;

Table dropped.

SQL> create table t 
  2  (
  3    p varchar2(1),
  4    w varchar2(1),
  5    q number(2)
  6  );

Table created.

SQL> insert into t ( p, w, q ) values ('A', 'X', 5); 

1 row created.

SQL> insert into t ( p, w, q ) values ('B', 'X', 4); 

1 row created.

SQL> insert into t ( p, w, q ) values ('C', 'Y', 3); 

1 row created.

SQL> insert into t ( p, w, q ) values ('A', 'Y', 3); 

1 row created.

SQL> insert into t ( p, w, q ) values ('A', 'Y', 1); 

1 row created.

SQL> insert into t ( p, w, q ) values ('B', 'Y', 1); 

1 row created.

SQL> commit;

Commit complete.

SQL> select p, sum(decode(w,'X',q,0)) x,
sum(decode(w,'Y',q,0)) y
  2  from t
  3  group by p;

P          X          Y
- ---------- ----------
A          5          4
B          4          1
C          0          3

SQL> 
--- Mohamad Arief Iskandar
<[EMAIL PROTECTED]> wrote:

> Dh,
> mohon pencerahan rekan-rekan. Saya punya data sbb :
> 
> PRODUK     WIRANIAGA     QUANTITI
> A                            X                      
> 5
> B                            X                      
> 4
> C                            Y                      
> 3
> A                            Y                      
> 3
> A                            Y                      
> 1
> B                            Y                      
> 1
> 
> Saya pingen melakukan query shg hasilnya sbb :
> 
> PRODUK                X                       Y
> A                               5                   
>    4
> B                               4                   
>    1
> C                               0                   
>    3
> 
> Saat ini saya hanya bisa mengeluarkan X atau Y saja.
> Apakah ada query yang bisa langsung menghasilkan
> tampilan diatas.
> 
> Tks, atas bantuannya
> 
> Arief
> 
> 


Send instant messages to your online friends http://uk.messenger.yahoo.com 

Kirim email ke