This question could asked somewhere before but I could not find it, anyways.
So I have a video record that has many comments, each comment belongs to a user. The user on the other hand has many user friends.
Now, when user X signs in and view video Y I want to display the comments of his friends first (ordered by most recent). Then list other comments ordered with most recent.
I would prefer to make this logic in one single query if possible.
Thanks,
In your ORDER BY, do something like the following. Please know that I have know idea what your schema looks like, so this query won’t work. But just create a 1/0 value indicating whether or not the user is a friend, and then order by that first, and then order by the posting / comment id afterwards