I have tables like this fake ones:
data:
id type month value
1 1 1 10
2 1 2 20
3 1 3 30
4 2 1 40
5 2 2 50
6 2 3 60
7 3 1 70
8 3 2 80
9 3 3 90
10 4 1 100
11 4 2 110
12 4 3 120
type:
id name
1 A
2 B
3 C
4 D
What I want:
month valueA valueB valueC valueD
1 10 40 70 100
2 20 50 80 110
3 30 60 90 120
How can I make this query?
I’m using Oracle 10g.
It looks like you want a relatively straightforward pivot of the data. If you were using 11g, you could use the more elegant PIVOT function. But in 10g, you could still do something like this