Difference between revisions of "MySQL"

Jump to navigation Jump to search
167 bytes added ,  13:37, 11 February 2010
m
Added "Select Rows"
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]]

Navigation menu