To make long story short:
I have table like this
nr sat col
1 1 dsag
1 2 gds
1 2 gds
2 1 gdsa
2 2 gf
2 3 gdsa
And expect the result like this:
nr Sat_1 Sat_2 Sat_3
1 1 2 0
2 1 1 1
I want new column for each row from "SELECT DISTINCT sat" and next group by nr
COUNT(DISTINCT col)withGROUP BY nr, satto get the numbers, and aPIVOTto get your desired display. To make this short story longer, please show what you've tried already.