I have a table like this:
Department |Jan |Feb |Mar | Apr|
+-----------+----+----+----+----+
|A | 1 |NULL|NULL|NULL|
|A |NULL|NULL|2 |NULL|
|A |NULL|NULL|NULL|7 |
|B | 1 |NULL|2 |NULL|
|B |NULL|NULL|5 |NULL|
|B |NULL|6 |NULL|NULL|
I want the output will be:
+-----------+----+----+----+----+
|Department |Jan |Feb |Mar | Apr|
+-----------+----+----+----+----+
|A | 1 |NULL|2 |7 |
|B | 1 |6 |2 |NULL|
|B |NULL|NULL|5 |NULL|
Does someone have an idea how to do this?
Actually I want to do max only to the null values, and group by to the rest..