Skip to content
Advertisement

T-SQL Group By summarize fields using logical functions

How can I aggregate and arrive to these results?

SELECT *
FROM TABLE
GROUP BY Column1 

enter image description here

Advertisement

Answer

Assuming the columns actually contain the literal string values 'TRUE' and 'FALSE', we could use:

SELECT
    Column1,
    MAX(Column2) AS Column2,
    MAX(Column3) AS Column3
FROM yourTable
GROUP BY
    Column1;
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement