Reputation: 159
i have such tables:
movie: id, user, title
thank: id, user, movie
what i need is to get count of thanks made TO specific user.
Upvotes: 0
Views: 45
Reputation: 59660
may be by
select count(*) from `thank` t join `movie` m on t.user=m.user
where m.user='<specific_usr>';
or if both have same field then why don't simply use
select count(*) from `thank` where user='<specific_usr>';
or if you want count for all user then try:
select user,count(*) from `thank` group by user;
Upvotes: 1