I have a simple relation between student and marks :

Student :

```
+------------+-------------+
| idStudent  | NameStudent |
+------------+-------------+
|         1  | Student A   |
|         2  | Student B   |
|         3  | Student C   |
+------------+-------------+

```

Marks :

```
+----------+------+-----------+
| idMarks  | mark | idStudent |
+----------+------+-----------+
|        1 | A    |         1 |
|        2 | A    |         1 |
|        3 | A    |         1 |
|        4 | A    |         2 |
|        5 | A    |         2 |
|        6 | C    |         3 |
|        7 | A    |         3 |
+----------+------+-----------+

```

I only want to have students who have a "A" in every exam they passed

```
SELECT *, COUNT(mark)
FROM student S
INNER JOIN marks M ON S.idStudent = M.idStudent
WHERE M.mark = "A"
GROUP BY S.idStudent

```

I tried this but I reach deadlock when I try to compare the number of exam they passed and the number of A they have...

I also tried with subqueries but it didn't work