Select Union Query problem

Posted by Krishma on Stack Overflow See other posts from Stack Overflow or by Krishma
Published on 2010-06-08T18:23:26Z Indexed on 2010/06/08 18:32 UTC
Read the original article Hit count: 682

Filed under:

I have 2 tables

Table A

id  name
------------    
1   Scott
2   Dan
3   Sam

Table B

id  name
------------    
1   Dan
2   Andi
3   Jess

Result needs to be

Id Name  Found
1  Scott A
2  Dan   C i.e. found in both
3  Sam   A
2  Andi  B
3  Jess  B

I am able to do UNION to fetch the result but how i generate column Founds. Any idea ?? Thank you in advance :)

© Stack Overflow or respective owner

Related posts about mysql