php - Mysql complex sorting -
i have query this
select videos.*, (select count(comment_id) comments comments.comments_video_id = videos.id) video_comments videos order video_comments desc
now if have 2 rows same 'videos_comments' count, how can write between these 2 videos, 1 had latest comment (comments_date) in comments table displayed first
select videos.id, count(*) video_comments videos left join comments on comments.comments_video_id = videos.id group videos.id order video_comments desc
Comments
Post a Comment