I have a table like this:

Column A    Column B
Agent A     abc@gmail.com
Agent B     abc@gmail.com
Agent A     abc@gmail.com
Agent B     def@gmail.com 
Agent C     efg@gmail.com

I want to see results where the same email address exists for Agents A and B.


Something like this:

select a.columna, a.email
from (select * from tablename where columna='A') a
join (select * from tablename where columna='B') b
on (a.columnB=b.ColumnB)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.