Concat function

Hello,

The data in the source looks like this:
Col1 | Col2 | Col3

1 | XYZ | Value1
2 | XYZ | Value2
3 | XYZ | Value3
4 | ABC | Value4
5 | ABC | Value5

There is a requirement to display the Col3 Object as a concatination of values per Col2. Which means that data should appear like this:
Col2 | Col3

XYZ | Value1/Value2/Value3
ABC | Value4/Value5

The problem is the number of values per Col2 is indefinite. There can be 2, 3, 5, 7, or any number of values; so a Case/When/Then statement will not do the trick

Any ideas on how I can design the Col3 object?

Thank you


dideb (BOB member since 2005-07-05)

Either crosstab this on a report, or create a simple stored procedure.

Some databases also allow you to create a pivot table, SQL Server, for one…


Mak 1 :uk: (BOB member since 2005-01-06)

If you have an indefinite number of values, you’ll need to use a database function.

This topic outlines how to do it in Oracle, including code that you can alter for your own purpose.