Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Pivot Help--I need to Pivot really to just make the rows the column


Pivot Help--I need to Pivot really to just make the rows the column

Author
Message
twdavis-893252
twdavis-893252
SSC Journeyman
SSC Journeyman (97 reputation)SSC Journeyman (97 reputation)SSC Journeyman (97 reputation)SSC Journeyman (97 reputation)SSC Journeyman (97 reputation)SSC Journeyman (97 reputation)SSC Journeyman (97 reputation)SSC Journeyman (97 reputation)

Group: General Forum Members
Points: 97 Visits: 363
SELECT CONVERT(varchar,C.SCHED_DTTM,101) as DATE,C.INV_ITEM_ID ,SUM(C.QTY_REQUESTED) AS QTY
FROM PS_IN_DEMAND C WHERE C.SCHED_DTTM>=GETDATE() AND C.IN_FULFILL_STATE IN (10,20,30,40)
GROUP BY C.SCHED_DTTM,C.INV_ITEM_ID
ORDER BY C.SCHED_DTTM,C.INV_ITEM_ID



DATE INV_ITEM_ID QTY
9/10/2013 W526R 2
9/10/2013 X426R 1
9/10/2013 6414 3
9/11/2013 2001-1 4
9/11/2013 2001-2 4
9/11/2013 2001-5 4
9/11/2013 10-1109R 1
9/12/2013 12401 1
9/12/2013 12402 1
9/12/2013 12405 1
9/12/2013 12406 1
9/12/2013 12433 1
9/12/2013 3801 1


Luis Cazares
Luis Cazares
SSCrazy Eights
SSCrazy Eights (8.5K reputation)SSCrazy Eights (8.5K reputation)SSCrazy Eights (8.5K reputation)SSCrazy Eights (8.5K reputation)SSCrazy Eights (8.5K reputation)SSCrazy Eights (8.5K reputation)SSCrazy Eights (8.5K reputation)SSCrazy Eights (8.5K reputation)

Group: General Forum Members
Points: 8508 Visits: 18117
You're not giving enough information.
We would be happy to help but we need you to be more explicit on what you need.
Please post the DDL for your tables and sample data in the form of INSERT statements, as well as the expected results based on that sample data.


Luis C.
General Disclaimer:
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?


How to post data/code on a forum to get the best help: Option 1 / Option 2
Jack Corbett
  Jack Corbett
SSChampion
SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)

Group: General Forum Members
Points: 11018 Visits: 14858
Take a look at the Cross Tab and Pivot links in my signature. I think they'll give you what you need.



Jack Corbett

Applications Developer

Don't let the good be the enemy of the best. -- Paul Fleming
At best you can say that one job may be more secure than another, but total job security is an illusion. -- Rod at work

Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
How to Post Performance Problems
Crosstabs and Pivots or How to turn rows into columns Part 1
Crosstabs and Pivots or How to turn rows into columns Part 2
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search