I am programing a script using a MySQL database, I am not very good in MySQL and only know some basic stuff, but I am already looking two days for a result for this problem that is maybe simple for many people.
Database of all members who has a profile.
DB table 'members'
ID | Username
-------------
1 | Ana
2 | Jim
3 | Bob
4 | Joe
5 | Ela
All members has a profile and they can vote for them.
'Profile' is the profile where they have been voted for.
'Member' is the user who have voted.
Database of all votes.
DB table 'profile_rate'
ID | Profile | Member | Rate
----------------------------
1 | Ana | Jim | Yes
2 | Ana | Bob | No
3 | Jim | Ana | Yes
4 | Bob | Ela | Yes
5 | Joe | Ana | No
6 | Ela | Joe | yes
7 | Bob | Ana | Yes
8 | Ana | Joe | No
Result wanted
I want to know for which profile Ana have been voted already.
In the case of Ana the result must be:
Username | Count
----------------
Ana | 0
Jim | 1
Bob | 1
Joe | 1
Ela | 0
If someone can help me with this problem...