Left join guilds to show players without guilds

This commit is contained in:
2024-10-31 00:00:40 +01:00
parent 79351c7402
commit 2dbb1cbd80
2 changed files with 3 additions and 3 deletions

View File

@@ -6,6 +6,6 @@ select
g.name as GuildName g.name as GuildName
from from
player p player p
join guild g on p.guild = g.id left join guild g on p.guild = g.id
where where
p.name = $1; p.name = $1;

View File

@@ -2,7 +2,7 @@ select
p.id, p.id,
p.name, p.name,
p.guild, p.guild,
g.name, coalesce(g.name, 'N/A'),
count(distinct n.player) as nnotes, count(distinct n.player) as nnotes,
count( count(
distinct case distinct case
@@ -15,6 +15,6 @@ from
left join note n on n.player = p.id left join note n on n.player = p.id
left join association a on a.lhs = p.id left join association a on a.lhs = p.id
or a.rhs = p.id or a.rhs = p.id
join guild g on p.guild = g.id left join guild g on p.guild = g.id
group by group by
p.id p.id