Return more data per player on listing all players

This commit is contained in:
2024-10-30 15:47:33 +01:00
parent 460503ba4a
commit 385b22d4e4
5 changed files with 63 additions and 6 deletions

20
backend/selectPlayers.sql Normal file
View File

@@ -0,0 +1,20 @@
select
p.id,
p.name,
p.guild,
g.name,
count(distinct n.player) as nnotes,
count(
distinct case
when a.lhs = p.id
or a.rhs = p.id then a.id
end
) as nassoc
from
player p
left join note n on n.player = p.id
left join association a on a.lhs = p.id
or a.rhs = p.id
join guild g on p.guild = g.id
group by
p.id