as it says in the title, I need to return two records but in the same column, for example (I clarify that the following code does not work, it is only to understand my case):
SELECT (NAMESS "|" LASTNAMESS), AGE
FROM PERSON
When doing the query, it would have to return something like Johnny|Depp in the first column and 45 in the second
CodePudding user response:
There are 2 methods to concat the fields in DB2.
- CONCAT function -
SELECT CONCAT(NAMESS, LASTNAMESS), AGE
FROM PERSON;
- Concat Operator i.e. '||' -
SELECT NAMESS || LASTNAMESS, AGE
FROM PERSON;