added join so room names show up instead of IDs to the biggest rooms on server sql

Karmanyaah Malhotra 2021-02-15 14:42:04 -05:00
parent 91534242ac
commit 8a1f607c33
1 changed files with 9 additions and 2 deletions

11
Home.md

@ -105,6 +105,13 @@ The log format can vary slightly depending on your log configuration, but here i
What are the biggest rooms on my server?
---
```
select room_id, count(*) as num_rows from state_groups_state group by room_id order by num_rows desc limit 10;
```sql
SELECT s.canonical_alias, g.room_id, count(*) AS num_rows
FROM
state_groups_state AS g,
room_stats_state AS s
WHERE g.room_id = s.room_id
GROUP BY s.canonical_alias, g.room_id
ORDER BY num_rows desc
LIMIT 10;
```