Something like this should do it, unless I’ve misunderstood what you’re after?
-- [params]
-- int :topic_id
SELECT tu.user_id,
tu.notification_level
FROM topic_users tu
WHERE tu.topic_id = :topic_id
ORDER BY tu.notification_level DESC
Something like this should do it, unless I’ve misunderstood what you’re after?
-- [params]
-- int :topic_id
SELECT tu.user_id,
tu.notification_level
FROM topic_users tu
WHERE tu.topic_id = :topic_id
ORDER BY tu.notification_level DESC