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

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -