2,187
edits
(→Data Types: Added Strings) |
(→JOIN: Added furthetr JOIN examples) |
||
Line 148: | Line 148: | ||
=== JOIN === | === JOIN === | ||
<source lang="mysql">SELECT make, model FROM table JOIN hosts ON table.id=hosts.id WHERE hosts.ip=INET_ATON('10.10.255.253');</source> | <source lang="mysql"> | ||
SELECT make, model FROM table JOIN hosts ON table.id=hosts.id WHERE hosts.ip=INET_ATON('10.10.255.253'); # Join with ON | |||
SELECT make, model FROM table JOIN hosts USING (id) WHERE hosts.ip=INET_ATON('10.10.255.253'); # Join with USING | |||
SELECT make, model, info FROM table JOIN hosts USING (id) JOIN notes ON (id) WHERE hosts.ip=INET_ATON('10.10.255.253'); # Multiple join | |||
</source> | |||
Different types of join will yield differing results, depending how different rows match up see http://www.wellho.net/mouth/158_MySQL-LEFT-JOIN-and-RIGHT-JOIN-INNER-JOIN-and-OUTER-JOIN.html | Different types of join will yield differing results, depending how different rows match up. It can be a bit flummoxing to start with, but its actually fairly simple once you've got the basic idea straight in your head, see - http://www.wellho.net/mouth/158_MySQL-LEFT-JOIN-and-RIGHT-JOIN-INNER-JOIN-and-OUTER-JOIN.html | ||
== Migrate Databases == | == Migrate Databases == |