How to get likes user westest message?

You need to get information on how to did like a user who views the messages. How to do it better?
At the moment the written request of posts and number of likes.
SELECT `p`.`id`, `p`.`userId`, `p`.`message`, COUNT(`pl`.`postId`) as cnt_likes
FROM `posts` AS `p`
LEFT JOIN `post_likes` AS `pl` ON `pl`.`postId` = `p`.`id`
WHERE `p`.`userId` = :userId
GROUP BY `p`.`id`
ORDER BY `p`.`id` DESC
July 9th 19 at 12:57
1 answer
July 9th 19 at 12:59
If post_likes has userid, then add another join:
LEFT JOIN `post_likes` AS `plu` ON `plu`.`postId` = `p`.`id` and `plu`.`userId` = `p`.`userid`

Find more questions by tags DatabasesMySQLSQLWeb Development