• something like this??

    DECLARE @Input TABLE

    (

    col1 INT,

    col2 INT,

    col3 VARCHAR(3),

    col4 VARCHAR(3),

    col5 VARCHAR(3)

    )

    INSERT INTO @Input VALUES(1, 122, 'AAA', null, null),(2, 122, null, 'BBB', null),(3, 122, null, null, 'CCC'),

    (4, 156, null, 'BBB', null), (5, 156, 'AAA', null, null), (6, 156, null, null, 'CCC')

    SELECT col2, MAX(col3) as col3, MAX(col4) as col4, MAX(col5) as col5

    FROM @Input

    GROUP BY col2

    Good Luck 🙂 .. Visit www.sqlsaga.com for more t-sql code snippets and BI related how to articles.