DB2 Merge Two Fields: CONCAT Guide

In DB2, you can combine data from two fields using the CONCAT function. Here is an example:

Assume there is a table called employee that has fields first_name and last_name, and we want to combine the data from these two fields to create a new field called full_name. This can be achieved by using the following SQL statement:

SELECT 
   CONCAT(first_name, ' ', last_name) AS full_name
FROM 
   employee;

In this example, the CONCAT function combines the data from the first_name and last_name fields and saves the result in a new field called full_name.

bannerAds