Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Pivot issues Expand / Collapse
Author
Message
Posted Friday, December 27, 2013 8:39 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, February 24, 2014 11:06 AM
Points: 109, Visits: 215
Happy holidays!

I am having issues using PIVOT. I have never seemed to truly understand the syntax behind it and I know this is a simple question....

I have a simple table that has 3 columns: DayofWeek (Mon - Fri), Time(8:00AM - 5:00PM for each day), and CallsOffered (This is the aggregate). I just need to pivot on the DayofWeek, so I can have Mon - Friday as column names and I cannot seem to do it correctly.

Any help would be greatly appreciated!

Dave
Post #1526173
Posted Friday, December 27, 2013 8:54 AM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Today @ 5:54 AM
Points: 3,908, Visits: 8,865
You could read this article to find out how to work with CROSS TABS.
http://www.sqlservercentral.com/articles/T-SQL/63681/

For a coded answer, please read the article linked in my signature to now what we need to help you.



Luis C.
Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

Forum Etiquette: How to post data/code on a forum to get the best help
Post #1526178
Posted Friday, December 27, 2013 8:58 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, February 24, 2014 11:06 AM
Points: 109, Visits: 215
Dude, I am asking for a simple PIVOT example. I am not sure why this is an issue? Please do not clog up my post with links. I am on a strict deadline.
Post #1526181
Posted Friday, December 27, 2013 9:04 AM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Today @ 5:54 AM
Points: 3,908, Visits: 8,865
I'm helping here for free.
If you want simple examples, you can press F1 and find examples on PIVOT. Or you can click on the "useless" link I provided to have different examples.
If you want examples based on your tables and information, you should give us something to work with as you're not the only one with deadlines.



Luis C.
Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

Forum Etiquette: How to post data/code on a forum to get the best help
Post #1526185
Posted Friday, December 27, 2013 9:06 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, February 24, 2014 11:06 AM
Points: 109, Visits: 215
Can someone help me please?????
Post #1526187
Posted Friday, December 27, 2013 9:08 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, February 24, 2014 11:06 AM
Points: 109, Visits: 215
I am not sure if I can create a simpler example than this...



Happy holidays!

I am having issues using PIVOT. I have never seemed to truly understand the syntax behind it and I know this is a simple question....

I have a simple table that has 3 columns: DayofWeek (Mon - Fri), Time(8:00AM - 5:00PM for each day), and CallsOffered (This is the aggregate). I just need to pivot on the DayofWeek, so I can have Mon - Friday as column names and I cannot seem to do it correctly.

Any help would be greatly appreciated!
Post #1526188
Posted Friday, December 27, 2013 9:29 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 12:51 AM
Points: 5,245, Visits: 12,164
DaveDB (12/27/2013)
Dude, I am asking for a simple PIVOT example. I am not sure why this is an issue? Please do not clog up my post with links. I am on a strict deadline.


You should post sample data, DDL and desired results if you want a working solution.

If you just want examples, there are thousands out there.



Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

When you ask a question (and please do ask a question: "My T-SQL does not work" just doesn't cut it), please provide enough information for us to understand its context.
Post #1526195
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse