alias the name of pivoted columns

  • How do you alias the CA to California and MN to Minnesota and still have 0s and 1s as the results

    SELECT

    *

    FROM

    (

    SELECT DISTINCT

    av._value member__id,

    m.persfname first_name,

    m.perslname last_name,

    lower(

    m.emailaddress

    ) email,

    a.CAT

    FROM

    prod.category a

    JOIN prod.anonymize_values av ON a.mnbr = av._value

    LEFT JOIN prod.member m ON m.mnbr = a.mnbr

    WHERE

    a.CAT IN ( 'CA', 'MN' )

    AND m.membernbr IS NOT NULL

    AND contractdate > sysdate - 2

    ) PIVOT (

    COUNT ( CAT )

    FOR CAT

    IN ( 'CA',

    'MN' )

    )

  • Thanks for posting your issue and hopefully someone will answer soon.

    This is an automated bump to increase visibility of your question.

  • 'sysdate' is an Oracle function?  Idk the syntax doesn't look like SQL Server

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

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

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