I am using T-SQL with MS SQL Server.
I have a table like this:
Category Value
A 150
B 200
C 300
A 120
A 300
C 500
D 200
...
I want to get a summary table like this:
DistinctCategory Value>100 Value>200 Value>300 ...(column value step is 100)
A 3 1 0
B 1 0 0
C 2 2 1
D 1 0 0
...
I guess a SQL pivot table can do this, but how to implement it?
Ideally, I want the summary table can be self-adaptive to the value range in the original table, and make the value step as 100 for each column. Can it be done with T-SQL script?
And more ideally, I hope I can specify the start/end/step value. :)