Sorry if this is a silly question, I searched a bit and couldn’t find a solution for an example like mine.
I’ve got a small photo sharing app with a query which outputs the ID numbers of users, ordered by the number of followers they have. I want to alter the query slightly so that if users have the same number of followers, they will be ordered by the number of photos they’ve uploaded instead.
How would I go about editing my query? All attempts I’ve made have been unsuccessful.
Current query looks like this:
SELECT Users.ID, COUNT(User_Followers.FollowingUserID)
AS follower_count FROM Users
LEFT JOIN User_Followers ON Users.ID = User_Followers.FollowingUserID
GROUP BY Users.ID
ORDER BY follower_count DESC
Where the User_Followers table looks like this:
ID UserID FollowingUserID DateFollowed
And the photos table looks like this:
ID PostedByUserID DatePosted
Thanks in advance for any help!
1 Answer