I have table people
Name | Score | Date
Don | A | 12-10-2014
Don | B | 12-10-2014
Mary | A | 12-10-2014
Mary | C | 12-10-2014
Mary | D | 12-10-2014
Jack | A | 12-10-2014
Jack | B | 12-10-2014
Jack | C | 12-10-2014
I want to get records which people with score A and B.
Mary | A | 12-10-2014
will no be in the result because she doesn't have score B. The result must both have A and B.
So the output should be the following. Mary should not in the result because she only has score A
Name | Score | Date
Don | A | 12-10-2014
Don | B | 12-10-2014
Jack | A | 12-10-2014
Jack | B | 12-10-2014
I have tried the following query but the result is not right.
select *
from people
where score='B' and Name in (select Name
from people
where score='A'
group by Name)
Don A 1 Jack A 2. Seems not right.