Postgres zostawił dołączenie
SELECT pka, c1, pkb, c2
FROM A
LEFT JOIN B ON pka = fka
Trained Tuna
SELECT pka, c1, pkb, c2
FROM A
LEFT JOIN B ON pka = fka
SELECT
name, author_id, count(*), t.total
FROM
names as n1
INNER JOIN LATERAL (
SELECT
count(*) as total
FROM
names as n2
WHERE
n2.id = n1.id
AND n2.author_id = n1.author_id
) as t ON 1=1
GROUP BY
n1.name, n1.author_id