Q:

Foreach non-unique rows to obtain a related key

Can such SELECTion be made? Based only on QTZ_USERS UUID can I "foreach" all memberships with GROUP_ID's to find the GROUP_ID with the highest prority?
How can I approach that?

A:

Assuming you want details from all the tables then join them together and to a sub query to get the latest priority for each user.
Something like the following (although select the actual columns you want rather than use SELECT *).
SELECT *
FROM QTZ_USERS u
INNER JOIN MEMBERSHIPS m
ON u.UUID = m.UUID
INNER JOIN GROUPS g
ON m.GROUP_ID = g.GROUP_ID
INNER JOIN
( 
    SELECT m.UUID, MAX(g.PRIORITY) AS max_priority
    FROM MEMBERSHIPS m
    INNER JOIN GROUPS g
    ON m.GROUP_ID = g.GROUP_ID
    GROUP BY m.UUID
) sub0
ON m.UUID = sub0.UUID
AND g.PRIORITY = sub0.max_priority

