Hello Janusz,
I'll have a go at this one. If your installation of MySQL/MariaDB has the JSON_EXTRACT function then you can use something like this:
- Code: Select all
SELECT sus_login_name, sus_name FROM zzzzsys_user WHERE zzzzsys_user_id IN (SELECT JSON_EXTRACT(sss_access, "$.session.zzzzsys_user_id") FROM zzzzsys_session)
If you have older versions then you could try:
- Code: Select all
SELECT u.sus_login_name,u.sus_name FROM zzzzsys_user u, zzzzsys_session s WHERE INSTR(s.sss_access, u.zzzzsys_user_id)
This is not 100% fool proof as it assumes the values in zzzzsys_user.zzzzsys_user_id are globally unique but a quick test suggests it should be OK to use.
There are probably more efficient ways of doing this but these do work. Please note that the session table could contain users who are no longer active but have not logged out properly. There are ways to determine when a user in the session table was last active.
I hope this helps.
Neil