on 2022 Jun 17 5:49 AM
Request clarification before answering.
Hi gjs_shankar,
Have you gone through this blog post : https://blogs.sap.com/2019/02/10/split-string-into-multiple-rows-using-sql-in-sap-hana/? If you replace the comma with semi-colon, it exactly fits into what you asked for.
Best Regards,
Abhi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Use this SQL.
SELECT
"COLUMN A" AS "SHOPPING CART",
"COLUMN B" AS "SC LINE ITEM" ,
SUBSTR_REGEXPR('[^;]' IN "COMMENT" OCCURRENCE 1) AS "COMMENT1",
SUBSTR_REGEXPR('[^;]' IN "COMMENT" OCCURRENCE 2) AS "COMMENT2",
SUBSTR_REGEXPR('[^;]' IN "COMMENT" OCCURRENCE 3) AS "COMMENT3",
FROM
<YOUR TABLE>;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For dynamic way of handling you may have to write sql function and call that function here..
For simplicity,
suppose your column is 20 char length, then divide by 2 - maximum 10 occurances will be there
so write 10 lines as above.. if value not there it will show as ?
but query will give output
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.