2,187
edits
m (Added "CREATE / ALTER Tables") |
m (→INSERT / UPDATE Rows: Added "UPDATE ... SELECT") |
||
Line 96: | Line 96: | ||
<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> | ||
<br>'''UPDATE ... SELECT'''<br> | |||
The syntax is not <code>UPDATE ... SELECT</code>, but it performs the function you'd expect from such a query, although its a little mis-leading. In the example below the <code>plat</code> table is updated from the <code>os</code> table. | |||
<source lang="mysql">UPDATE plat,os SET plat.osid=os.osid WHERE os.os_supplied='Microsoft(R) Windows(R) Server 2003, Standard Edition';</source> | |||
== SELECT Rows == | == SELECT Rows == |