How to Merge Data in DB2?
In DB2, you can use the GROUP BY clause and aggregate functions to combine multiple rows of data into one. Here is an example SQL statement:
SELECT column1, column2, SUM(column3) AS total_column3
FROM your_table
GROUP BY column1, column2;
In this example, we selected column1 and column2, summed the values in column3, and used a GROUP BY clause to combine rows with the same column1 and column2 values into one, with the summed value from column3 displayed as total_column3. You can modify the columns and aggregate functions in the SELECT statement according to your needs.