I'm thinking for someone new to mysql it's going to be a nasty learning curve to get that query. Offhand, assuming it's using basic relations, the query is going to look something like this. I didn't test this so I'm sure it won't work right away.
SUM( C.name = 'wanted_nameA' = O.name = 'wanted_nameA' ) AND
SUM( C.name = 'wanted_nameB' = O.name = 'wanted_nameB' ) as match
FROM
Candidates as C, Votes as V, Offices as O
WHERE
C.name = O.candidate_name_fk
and C.name = V.candidate_name_fk
GROUP BY V.votername
HAVING match
ORDER BY V.votername
Otherwise, it may just be best to write a program and get used to the DBI.
Code:
SELECT V.votername, SUM( C.name = 'wanted_nameA' = O.name = 'wanted_nameA' ) AND
SUM( C.name = 'wanted_nameB' = O.name = 'wanted_nameB' ) as match
FROM
Candidates as C, Votes as V, Offices as O
WHERE
C.name = O.candidate_name_fk
and C.name = V.candidate_name_fk
GROUP BY V.votername
HAVING match
ORDER BY V.votername
Otherwise, it may just be best to write a program and get used to the DBI.