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

  • 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

    [p]DATEINV_ITEM_IDQTY

    9/10/2013W526R2

    9/10/2013X426R1

    9/10/201364143

    9/11/20132001-14

    9/11/20132001-24

    9/11/20132001-54

    9/11/201310-1109R1

    9/12/2013124011

    9/12/2013124021

    9/12/2013124051

    9/12/2013124061

    9/12/2013124331

    9/12/201338011

    [/p]

  • 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
  • Take a look at the Cross Tab and Pivot links in my signature. I think they'll give you what you need.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply