sqlhana

SQL command to turn 261/261/261/261/262/262 into 261/262


What kind of SQL operation has be applied to get from point A to point B :

point A

261/261/261/261/262/262/261/262/261/261/261

point B

261/262

Thanks

I can't use DISTINCT , GROUPING prior to STRING_AGG operator , I don't see any other option how to reduce the number of 261, 262


Solution

  • You can very easily achieve this by using SPLIT_TO_TABLE hana function. Once you get the split values as rows in a one column table you can SELECT DISTINCT them and then STRING_AGG them as documented here

    I'll let you put together the code to do this as I don't have a hana running environment to verify the correctness.

    Hope it helped.