T-sql puzzle

  • Hey guys,

    I'm fairly newbie with SQL and have been struggling with this used case. I would appreciate any help.

    Table has values:

    ID NL1 NL2 NL3

    50 null null 21

    50 null 18 null

    50 20 null null

    Expected result:

    ID NL1 NL2 NL3

    50 20 18 21

    I tried using case but I didnt get anywhere. Any help would be appreciated!

  • DataEnthusiast (11/18/2014)


    Hey guys,

    I'm fairly newbie with SQL and have been struggling with this used case. I would appreciate any help.

    Table has values:

    ID NL1 NL2 NL3

    50 null null 21

    50 null 18 null

    50 20 null null

    Expected result:

    ID NL1 NL2 NL3

    50 20 18 21

    I tried using case but I didnt get anywhere. Any help would be appreciated!

    select ID, MAX(NL1) as NL1, MAX(NL2) as NL2, MAX(NL3) as NL3

    from myTable

    group by ID;

  • Oh shit! You made it look so easy loll...You're awesome

    Thanks Lynn 🙂

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

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