Oracle10g以上的版本中提供了转换组合函数。
例如表test_t的原始数据查询结果为:
比如现在查看这条SQL:
例如表test_t的原始数据查询结果为:
select * from latty.test_t
1 200405 5761 G 7393344.04
2 200405 5761 J 5667089.85
3 200405 5762 G 6315075.96
4 200405 5762 J 6328716.15
5 200405 5763 G 7393344.04
6 200405 5763 J 5667089.85
7 200405 5764 G 6028670.45
8 200405 5764 J 6459121.49
9 200405 5765 G 13156065.77
10 200405 5765 J 11901671.70
11 200406 5761 G 7614587.96
12 200406 5761 J 5704343.05
13 200406 5762 G 6556992.60
14 200406 5762 J 6238068.05
15 200406 5763 G 7614587.96
16 200406 5763 J 5704343.05
17 200406 5764 G 6387706.01
18 200406 5764 J 6907481.66
19 200406 5765 G 13562968.81
20 200406 5765 J 12495492.50
21 200407 5761 G 7987050.65
22 200407 5761 J 5723215.28
23 200407 5762 G 6833096.68
24 200407 5762 J 6391201.44
25 200407 5763 G 7987050.65
26 200407 5763 J 5723215.28
27 200407 5764 G 6456433.23
28 200407 5764 J 6987660.53
29 200407 5765 G 14000101.20
30 200407 5765 J 12301780.20
31 200408 5761 G 8085170.84
32 200408 5761 J 6050611.37
33 200408 5762 G 6854584.22
34 200408 5762 J 6521884.50
35 200408 5763 G 8085170.84
36 200408 5763 J 6050611.37
37 200408 5764 G 6587559.23
比如现在查看这条SQL:
select wm_concat(area_code) 用户名 from latty.test_t group by bill_month;
执行结果为:
1 5761,5761,5762,5763,5764,5765,5765,5764,5763,5762
2 5761,5762,5763,5764,5765,5765,5764,5763,5762,5761
3 5761,5764,5765,5765,5764,5763,5761,5762,5763,5762
4 5761,5762,5762,5763,5764,5763,5761