Search code examples
sqlsybase

SQL - Remove Blanks/nulls rows and combine rows


I want to combine multiple rows into as few rows as possible by removing nulls

Current: Table1 CurrentTable

want: Table2: WantTable


Solution

  • For your sample data and results you can use:

    select column1, column2, min(column3), min(column4), . . .,
           column8
    from t
    group by column1, column2, column8;