find records with two entries in a table
Posted: Wed Mar 14, 2007 2:18 pm
Hello,
I have a table that has two columns: 'id', and 'activity.' The 'id' references an auto-increment field in another table. The 'activity' is a code for an activity the member participated in.
The table might look like this:
id | activity
0034 | A
0048 | B
0034 | B
0091 | A
I want to write a query that returns the number of members who have done both activity 'A' and 'B.' In this case, it would return 1, because only id 0034 has participated in both activities.
Can anyone help me out?
Thanks!
I have a table that has two columns: 'id', and 'activity.' The 'id' references an auto-increment field in another table. The 'activity' is a code for an activity the member participated in.
The table might look like this:
id | activity
0034 | A
0048 | B
0034 | B
0091 | A
I want to write a query that returns the number of members who have done both activity 'A' and 'B.' In this case, it would return 1, because only id 0034 has participated in both activities.
Can anyone help me out?
Thanks!