SQL Combining duplicate rows
Is there a quick method to combine rows together where they are the same (based on some ordering).
I have a history table, but alot of the rows are effectively duplicated.
I.e.
ID |Status |Value |update_date
1 |Open | $100 |01/01/2019
1 |Open | $100 |02/01/2019
1 |Pending| $100 |21/01/2019
1 |Open | $100 |25/01/2019
So I want a table that would be have rows 1 & 2 combined
1 |Open | $100 |01/01/2019
1 |Pending| $100 |21/01/2019
1 |Open | $100 |25/01/2019
Basic group by doesnt work, because it joins the first and the last rows together.
I have examples where there are 50 updates with no changes. Do i just need to do comparison.
Or I could do a delete I guess? if the next row fields = current row fields delete??
|