Hello,
I would like to export the "Tags" of all users from Connection via SQL/DB2. It would be best if all user tags were included for the individual users.
How can I best do that?
I have already found the DB "PEOPLE_TAG" and could export them, but the assignment to the users is missing here.
Many thanks for help.
Regards
Max
You can join using PROF_TARGET_KEY column. Something like this, I think.
We are using Oracle but the approach will be similar:
SELECT
e.PROF_DISPLAY_NAME,
e.PROF_MAIL,
t.TAGS
from EMPINST.EMPLOYEE e
JOIN
(select
PROF_TARGET_KEY,
listagg(PROF_TAG, ', ')
within group
(order by PROF_TAG) tags
from
EMPINST.PEOPLE_TAG
group by
PROF_TARGET_KEY
) t on e.PROF_KEY = t.PROF_TARGET_KEY
;
I've just checked the DB2 syntax and I guess the code above should work for DB2 as DB2 also has listagg() function.
https://www.ibm.com/support/producthub/db2/docs/content/SSEPGG_11.5.0/com.ibm.db2.luw.sql.ref.doc/doc/r0058709.html
Hi Anatoly,
it works! Many many thanks for the fast help!
Have a nice week! :-)
Best Regards
Max