Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

PIVOT SQL help

$
0
0

Good Morning all,

Currently I have a table that looks like the following:

NameType ActivatedEmailDays
School Name #1Type #150 70130
School Name #1Type #1360 3601
School Name #1Type #12562562
...
School Name #1Type#15454 40

I want to convert this into a table that:

NameType DaysActivated

School Name #1Type #115Sum(Activated from Day 0 to Day 15)
School Name #1Type #130Sum(Activated from Day 16 to Day 30)
School Name #1Type #160Sum(Activated from Day 31 to Day 60)
...
School Name #1Type #1>360SUM(Activated after Day 360)

Is there a way to do this. I was thinking of possibly the PIVOT function, but I am not sure how I would do such a thing.


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>