Return more data per player on listing all players
This commit is contained in:
20
backend/selectPlayers.sql
Normal file
20
backend/selectPlayers.sql
Normal 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
|
||||
Reference in New Issue
Block a user