I am looking to use the pivot function with Spark SQL (not Python)

nickg
New Contributor III

Hello. I am trying to using the Pivot function for email addresses. This is what I have so far:

Select fname, lname, awUniqueID, Email1, Email2

From xxxxxxxx

Pivot (

    count(Email) as Test

    For Email

    In (1 as Email1, 2 as Email2)

    )

I get everything I need except Email1 and Email2 have null values instead of actual email addresses. I just need a little push to get me over the edge. Thanks.