大哥们,列循环问题,急啊!
字段:
aa
1
2
3
4
5
6
7
8
9
10
11
12
13
要求显示的是
aa1 aa2 aa3 aa4 aa5
1 2 3 4 5
6 7 8 9 10
11 12
菜鸟小弟谢谢了
[解决办法]
try
Select
Max(Case (aa - 1) % 5 When 0 Then aa Else 0 End) As aa1,
Max(Case (aa - 1) % 5 When 1 Then aa Else 0 End) As aa2,
Max(Case (aa - 1) % 5 When 2 Then aa Else 0 End) As aa3,
Max(Case (aa - 1) % 5 When 3 Then aa Else 0 End) As aa4,
Max(Case (aa - 1) % 5 When 4 Then aa Else 0 End) As aa5
From
表
Group By
(aa - 1) / 5