I have two tables. Say:
This is table 1
+--------+-----------------------+
| stuff | foreing | foreing2 |
+--------+-----------------------+
| bazzzz | 555 | 666 |
+--------+-----------------------+
This is table 2
+-----------------------+
| id_table | values |
+-----------------------+
| 555 | Foo |
+-----------------------+
| 666 | Bar |
+-----------------------+
What I want is a SQL query that gives me a row with this info:
+--------+-----------------------+
| stuff | value1 | value2 |
+--------+-----------------------+
| bazzzz | Foo | Bar |
+--------+-----------------------+
This is what I tried to do, but actually it returns two rows, which is not what I want:
SELECT table1.stuff,
table2.values as value1,
table2.values as value2
WHERE table1.foreing = table2.id_table
OR table1.foreing2 = table2.id_table