reduce number of rows by joining rows based on id and category

The data I have is below format :

enter image description here

Data I want in the final table:

enter image description here

Not sure how to do this one.


You can use group by to achieve that.

select id, category, max(actual_date) actual_date, max(planned_date)planned_date
from tablename
group by  id, category

Leave a Reply

Your email address will not be published. Required fields are marked *