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' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -