I have a table structure as under:
ID A B -- --- ----- 1 a a1 2 b b1 3 a a2 4 c a1 5 b b2
SELECT DISTINCT A FROM tablename WHERE B = 'a1' OR B = 'a2'
I think this should do the trick. Distinct is added so the value 'a' in A will only display once.