sql query help# Database - 数据库
x*g
1 楼
I have data as follows:
A b c
A d c
A h d
B a c
C a d
B a a
A b b
I want to return something like this:
A b c
d c
h d
b b
subtotal 4
B a c
a a
subtotal 2
C a d
subtotal 1
total 7
I tried rollup and cube but can't get it work,
can anyone help? Thanks.
A b c
A d c
A h d
B a c
C a d
B a a
A b b
I want to return something like this:
A b c
d c
h d
b b
subtotal 4
B a c
a a
subtotal 2
C a d
subtotal 1
total 7
I tried rollup and cube but can't get it work,
can anyone help? Thanks.