this query gives top 5 number of tweets, username and number of tweets thay have
SELECT users.username, COUNT(tweet.content) as tweet _count
FROM tweets
INNER JOIN users
ON tweets.userid=users.id
GROUP BY userid ORDER BY tweet_count DESC
LIMIT 5
to explain further here are the tables involved
retweets table is composed of
id, tweet_id, userid, date_created
tweets table is composed of
id, userid, content, date_created
users table is composed of
id and username
as you can see retweets use the content of the tweets table through tweet_id and user_id.
now the problem is i want a query that gives top 5 number of retweets, username and number of retweets thay have..
im kinda confused with joining several tables and i keep getting errors when i try. THANKS FOR YOUR HELP!