Advertisement

03.28.2008 at 01:53PM PDT, ID: 23278543
[x]
Attachment Details

SQL Server change table structure

Asked by Mittensonmaui in Microsoft Development, MS SQL Server

I need help with the following
I have a few ideas but was wondering if there was an easier way

The following code gives me

Compliance      23      24       19      8   etc.......

I want it to be in this format
Compliance
23
24
19
8

In other words compliance should be a column and not a row.

Insert into #TotalledDHours (DiscCategory, month1, month2, month3, month4, month5, month6, month7, month8, month9, month10, month11, month12)
Select DiscCategory, sum(month1),  sum(month2),  sum(month3), sum(month4), sum(month5), sum(month6), sum(month7) , sum(month8), sum(month9), sum(month10), sum(month11), sum(month12)  
from #TempCategorySummed    
Group by DiscCategory
Order by DiscCategoryStart Free Trial
[+][-]03.28.2008 at 10:45PM PDT, ID: 21235675

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.29.2008 at 04:19AM PDT, ID: 21236163

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Microsoft Development, MS SQL Server
Sign Up Now!
Solution Provided By: Lowfatspread
Participating Experts: 2
Solution Grade: B
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628