Created
November 3, 2021 02:42
-
-
Save anonfloppa/38aac16d8caf3f3b1f29cab65d508e78 to your computer and use it in GitHub Desktop.
query to list matrix users by the amount of rooms they are in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select private_rooms.user_id, public_room_count + private_room_count as total_rooms | |
from (select user_id, count(distinct room_id) as private_room_count from users_who_share_private_rooms where user_id <> '' group by user_id) as private_rooms | |
inner join (select user_id, count(distinct room_id) as public_room_count from users_in_public_rooms where user_id <> '' group by user_id) as public_rooms on | |
public_rooms.user_id=private_rooms.user_id | |
order by total_rooms desc; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment