Hi. I have two tables: Table1 (COD, NOM) ===== 100 AA 200 BB 300 CC 400 DD Table2: (COD, NOM) ===== 200 BB 350 FF 400 DDE 500 HH I want this result from Table2 COD NOM1 NOM2 200 BB BB 350 FF 400 DD DDE 500 HH Somebody can help me?
It's a good idea with these kinds of queries to set up a sql fiddle so that people can quickly write and test their suggestions. Here's mine: http://sqlfiddle.com/#!9/8620b/5
I found this: SELECT * FROM tabla2 LEFT OUTER JOIN tabla1 ON tabla1.codigo=tabla2.codigo PHP: I have the same result.