Very Basic PIVOT function, first try

  • SELECT
    *
    From
      (SELECT
      Line_item_Duty as [DUTY],
      [Supplier] as [SUPPLIER],
      Datepart(MM,Entry_Summary_Date) as [MONTH]
        from [ADHOC].[ATS_ESH] H
    INNER JOIN ADHOC.ATS_ESL L
      ON H.TRANS_SK = L.trans_Sk
    WHERE
    H.Importer = 'FORD'
    AND Entry_Summary_Date > '1/1/2018')
    as Data
    PIVOT
    (
    Sum([DUTY])
    FOR 
    [Month] 
      IN ('01','02')
    ) AS JEFF

    Results in Error: Incorrect syntax near '01'.

    Thoughts? thanks so much

  • Solved

    WOW, i fixed it myself!  (i don't get out much)

    I need to put 01 and 01 in FULL quotes . . . "01","02"

    SOLVED

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

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