2

I am not sure that is a "SELECT/JOIN" problem but I really don't know how to formulate the question. Perhaps you could suggest a better title

I have a table (table-a) with a list of items, I Want to associate the information of table-B.col2 when it is equal to "1"

What query should I write?

Table A   
Col1
AAA
BBB            
DDD
EEE                        
                          AAA 1
Table B      =====>       BBB         
Col1  Col2                DDD 1
AAA   1                   EEE
AAA   2   
BBB   2
CCC   1
CCC   3
DDD   1
FFF   1
James Anderson
  • 5,725
  • 2
  • 26
  • 43
Emmanuel
  • 123
  • 3

1 Answers1

4

This is a simple "filtered" outer join:

select a.col1, b.col2 
from table_a a
  left join table_b b on a.col1 = b.col1 and b.col2 = 1