Postgresql – Updating from a subquery when no results are returned
I have a post table that stores the most liked comment (top_comment). I need an SQL statement that updates the top_comment when a comment is liked/unliked: UPDATE post SET top_comment = T1.body FROM ( SELECT body FROM comment WHERE count_like…