I've tried it anyway, but it does not fit me SubSelect
. I used the toSql()
method to confirm and it really does not mount.
SQL
SELECT p.descr,p.dt_hr, (SELECT u1.name FROM users u1 WHERE u1.id = f.id_friend) AS name
FROM friends f JOIN users u ON u.id = f.id_user
JOIN posts p ON p.id_user = f.id_friend
WHERE u.id = 1
ORDER BY p.dt_hr DESC