table a LEFT OUTER JOIN table b:
This will OUTER JOIN table b, and only return fields that are true, or else leave the field(s) empty and still return the table a values.|
id |
name |
worktype |
|
1 |
Dag Jonny |
1 |
|
2 |
Jonny be good |
2 |
|
id |
worktype |
country |
|
1 |
King |
1 |
|
2 |
Emperor |
2 |
|
id |
country |
|
1 |
Norway |
|
2 |
China |
Implicit: SELECT a.name, b.worktype, c.country FROM table1 a, table2 b, table3 c WHERE a.worktype=b.id AND b.country=c.id Explicit: SELECT a.name, b.worktype, c.country FROM table1 a INNER JOIN (table2 b INNER JOIN table3 c ON b.country=c.id) ON a.worktype=b.id
table a INNER JOIN table b INNER JOIN table ctable a INNER JOIN (table b INNER JOIN table c ON b.somevalue = c.somevalue)table a INNER JOIN (table b INNER JOIN table c ON b.somevalue = c.somevalue) ON a.somevalue = b.somevalue