2,187
edits
(→SELECT Rows: Added COUNT) |
(→INSERT / UPDATE Rows: Updated) |
||
Line 134: | Line 134: | ||
<br>'''UPDATE ... SELECT'''<br> | <br>'''UPDATE ... SELECT'''<br> | ||
Here the <code>table</code> table is being updated from the <code>hware</code> table. | |||
<source lang="mysql">UPDATE table SET make=(SELECT make FROM hware WHERE id=5) WHERE tid=2;</source> | |||
Alternatively, 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> | <source lang="mysql">UPDATE plat,os SET plat.osid=os.osid WHERE os.os_supplied='Microsoft(R) Windows(R) Server 2003, Standard Edition';</source> | ||