I am using SQL Server 2012 and I need to write a query that would do give me the following output:
Code Value
FRBAR 0
ENSPA 1
DEWINE 1
...
To achieve the above, I am working with 2 specific tables in my database, namely Table A and Table B. Table A has a column called CodeA and Table B has a column called CodeB.
I want to write a T-sql query that would match all the values in column CodeA with those in column CodeB and ouput the result I mentioned above.
I know I need to do a JOIN on these 2 columns but I am confused about how to implement the logic of returning a 1 if there is a match and a 0 otherwise.