I use Typeorm
I need to get the records out of the tables. The first table is for the community that the user is subscribed to and the second table is for the user records that the current user is subscribed to
It turns out that the inner strings conflict with each other
const posts = await db.query(`
select
p.*
from post p
left join "subsite" s on p.subsite_slug = s.slug
inner join "subsite_follow" f on f.subsite_id = s.id and f.user_id = $1
left join "user" u on p.author_id = u.id
inner join "user_following" uf on uf.user_id_2 = u.id and uf.user_id_1 = $1
`, [req.user.id])
there are two columns in the user_following table
user_id_1 and user_id_2