SQL Convert rows into columns

Hi How can I convert this

sDate            Domain      Usage
2015-08-01      ASIA      2015
2015-08-01      CORP      4011
2015-08-01      EMEA      725
2015-08-02      ASIA      4086
2015-08-02      CORP      4731
2015-08-02      EMEA      993
2015-08-03      ASIA      4462
2015-08-03      CORP      14050
2015-08-03      EMEA      2265
2015-08-04      ASIA      4611
2015-08-04      CORP      13949
2015-08-04      EMEA      1788
2015-08-05      ASIA      4503
2015-08-05      CORP      14295
2015-08-05      EMEA      2125
2015-08-06      ASIA      4252

to

sDate            ASIA      CORP      EMEA
2015-08-01      2015      4011      725
2015-08-02      4086      4731      993
2015-08-03      4611      14050      2265
2015-08-04      4611      13949      1788
2015-08-05      4503      14295      2125
2015-08-06      4252
LVL 4
Mauro CazabonnetSenior .NET Software EngineerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
try:

SELECT sDate , 
 sum(case when Domain = 'ASIA' then Usage ELSE 0 end) As ASIA, 
 sum(case when Domain = 'CORP' then Usage ELSE 0 end) As CORP, 
 sum(case when Domain = 'EMEA' then Usage ELSE 0 end) As EMEA
 FROM yourTable
 GROUP BY sDate 
Order By sDate 

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Mauro CazabonnetSenior .NET Software EngineerAuthor Commented:
Thx...
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.