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

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

Making Empty C++ Project: General exception (Exception from HRESULT:0x80131500) Visual Studio Community 2015 -

How to fix java warning for "The value of the local variable is not used " -