I have three tables (deb, dos, char) and I'm looking for an SQL query to get the result table as shown in the following:
table: deb
+----+-------------+--------+
| id | label | dos_id |
+----+-------------+--------+
| 1 | right | 1 |
| 2 | left | 2 |
+----+-------------+--------+
table:char
+----+-------------+--------+
| id | name | dos_id |
+----+-------------+--------+
| 1 | jack | 1 |
| 2 | thaw | 1 |
| 3 | lbaz | 2 |
| 4 | amar | 3 |
+----+-------------+--------+
table:dos
+----+-------------+
| id | color |
+----+-------------+
| 1 | black |
| 2 | white |
+----+-------------+
result table
+----+-------------+--------+
| id | color | value |
+----+-------------+--------+
| 1 | black | right |
| 1 | black | jack |
| 1 | black | thaw |
| 2 | white | left |
| 2 | white | lbaz |
| 2 | white | amar |
+----+-------------+--------+
I tried joining left and right but It didn't work.
What I'm looking for is that for each dos line I get corresponding char and deb values in other column.
Maybe making a row select query in one could help. I don't know.
Please help me and thanks.