2023-03-28

COGNOS SQL: COLUMN 1+'|'+COLUMN 2 +'|'+COLUMN 3 keeps only first row information instead of concatenating just columns for each row

I have a database with 3 columns and I want to generate a report with only one column, that is the concatenation of column 1-ID, column 2-DATE and column 3-LOCATION separated with pipeline:

ID DATE LOCATION
10 20230325 UK
11 20230325 UK
11 20230325 US
12 20230323 PT

I have tried concatenating the columns with '+' into a new column 4 like so: DATE+'|'+ID+'|'+LOCATION

However, when I prepare a report and only select column 4, I am only getting one row instead of the 4 rows of data in the database:

Current output of column 4--> 1 row only with the following value:

10|20230325|UK

Expected output of column 4--> 4 rows with the following values:

10|20230325|UK
11|20230325|UK
11|20230325|US
12|20230323|PT

How can I concatenate the 3 columns with pipeline delimiter and generate a report where all rows are shown instead of just the first row?



No comments:

Post a Comment