itu pivot sepertinya....
SELECT
brach,
MAX(DECODE(type,'X1',total,null)) X1,
MAX(DECODE(type,'X2',total,null)) X2,
MAX(DECODE(type,'X2',total,null)) X2
FROM
(
SELECT brach,type,count(*) total
FROM saya_punya_table
GROUP BY brach,type
)
GROUP BY brach;
ratno
AnRof Rawnan wrote:
>
> Dear,
>
> mohon bantuannya untuk case berikut, mohon maaf bila
sudah pernah...:)
> bila saya punya table
>
> |BRANCH |TYPE |
> --------------------------------
> |A |X1 |
> |A |X1 |
> |A |X2 |
> |A |X3 |
> |B |X1 |
> |B |X2 |
> |B |X2 |
> |B |X3 |
> |C |X1 |
> |C |X2 |
> |C |X3 |
> |C |X3 |
> -----------------
>
> bagaimana querynya untuk mendapatkan hasil :
>
> ---------------------------
> X1 X2 X3
> ---------------------------
> A 2 1 1
> B 1 2 1
> C 1 1 2
>
> Terima Kasih sebelumnya...
>
> --
> YM_id : muh_ilman_a
> http://misisawa.blogspot.com
<http://misisawa.blogspot.com>
> http://anrof.myminicity.com/
<http://anrof.myminicity.com/>
>
> [Non-text portions of this message have been
removed]
>
>
____________________________________________________________________________________
Looking for last minute shopping deals?
Find them fast with Yahoo! Search.
http://tools.search.yahoo.com/newsearch/category.php?category=shopping