mirror of
https://codeberg.org/demostf/db.git
synced 2026-06-03 10:04:10 +02:00
unique named users
This commit is contained in:
parent
4478ce596f
commit
19047c93dd
1 changed files with 5 additions and 2 deletions
|
|
@ -533,10 +533,13 @@ CREATE MATERIALIZED VIEW users_named AS
|
||||||
rank() over (partition by user_id order by user_id, count desc) rn
|
rank() over (partition by user_id order by user_id, count desc) rn
|
||||||
from name_list
|
from name_list
|
||||||
)
|
)
|
||||||
select id, steamid, n.name, avatar, token
|
select id, steamid, max(n.name) as name, max(avatar) as avatar, max(token) as token
|
||||||
from names n
|
from names n
|
||||||
inner join users u on u.id = n.user_id
|
inner join users u on u.id = n.user_id
|
||||||
where rn = 1;
|
where rn = 1 group by id, steamid;
|
||||||
|
|
||||||
|
CREATE UNIQUE INDEX users_named_id ON users_named USING BTREE (id);
|
||||||
|
CREATE UNIQUE INDEX users_named_steam_id ON users_named USING BTREE (steamid);
|
||||||
|
|
||||||
--
|
--
|
||||||
-- PostgreSQL database dump complete
|
-- PostgreSQL database dump complete
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue