2,187
edits
m (→Insert / Update Rows: Added "INSERT ... SELECT") |
m (Added "Select Rows") |
||
Line 81: | Line 81: | ||
Used when you want you want include data from another table in an <code>INSERT</code> statement (eg you want to reference a unique ID in another table) | Used when you want you want include data from another table in an <code>INSERT</code> statement (eg you want to reference a unique ID in another table) | ||
<source lang="mysql">INSERT INTO table (id, make, model) SELECT id, 'DELL', 'PE1950' FROM hosts WHERE ip=INET_ATON('159.104.7.171');</source> | <source lang="mysql">INSERT INTO table (id, make, model) SELECT id, 'DELL', 'PE1950' FROM hosts WHERE ip=INET_ATON('159.104.7.171');</source> | ||
== Select Rows == | |||
'''Joins''' | |||
<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> | |||
== Software Packages == | == Software Packages == | ||
[[Category:MySQL]] | [[Category:MySQL]] |