Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Cross tabulation (matrix) with sql

Cross tabulation (matrix) with sql

From: Cees van Drunen <icg_cees_at_euronet.nl>
Date: 20 Sep 1998 10:15:36 GMT
Message-ID: <6u2kk8$s3@news3.euro.net>


I need to make a cross tabulation (matrix table) with the number of occurences for each set of discrete values of 2 columns, e.g.

Table :

 col1     col2     value
    1          4        10
    1          4        11
    1          5        12
    2          4        11
    2          5        13
    2          5        15
    2          5        16
    2          6        11

Cross tab:
           4        5        6
 ---------------------------
1    |    2        1        0
2    |    1        3        1

How can I do that with SQL, taking into account that I don't know the number of levels nor the values of these discrete variables ( col1 and col 2). (If that is known it can be done with the decode function)

Cees van Drunen
icg_cees_at_euronet.nl Received on Sun Sep 20 1998 - 05:15:36 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US