I know this is basic but I find it tricky and couldn’t quite phrase the question right in order to find the answer.
What I’d like to do is take these tables –
Table names
name | nameID |
-----------------
Jhon | 1
Bob | 2
George | 3
Kim | 4
Table mark
nameID | child
--------------
1 | 0
1 | 0
1 | 1
2 | 1
2 | 0
2 | 1
3 | 0
3 | 0
4 | 1
4 | 1
4 | 1
4 | 0
And then count how many times each name from table names appears in table mark with child=1, so you’ll get:
name | count
--------------
Jhon | 1
Bob | 2
Kim | 3
try this.