30,997
edits
Tag: 2017 source edit |
Tag: 2017 source edit |
||
| Line 344: | Line 344: | ||
MySQL Syntax: | MySQL Syntax: | ||
<syntaxhighlight lang="sql"> | <syntaxhighlight lang="sql"> | ||
UPDATE | UPDATE table_target as target, table_source as source SET fieldtarget=source.fieldsource | ||
WHERE source.rowid=target.rowid; | WHERE source.rowid=target.rowid; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 350: | Line 350: | ||
PgSQL Syntax: | PgSQL Syntax: | ||
<syntaxhighlight lang="sql"> | <syntaxhighlight lang="sql"> | ||
UPDATE | UPDATE table_target as target SET fieldtarget=source.fieldsource | ||
FROM table_source as source WHERE source.rowid=target.rowid; | FROM table_source as source WHERE source.rowid=target.rowid; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 357: | Line 357: | ||
<syntaxhighlight lang="PHP"> | <syntaxhighlight lang="PHP"> | ||
if ($this->db->type=='pgsql') { | if ($this->db->type=='pgsql') { | ||
$sql="UPDATE | $sql="UPDATE table_target as target SET fieldtarget=source.fieldsource | ||
FROM table_source as source WHERE source.rowid=target.rowid"; | FROM table_source as source WHERE source.rowid=target.rowid"; | ||
} else { | } else { | ||
$sql= "UPDATE | $sql= "UPDATE table_target as target, table_source as source SET fieldtarget=source.fieldsource | ||
WHERE source.rowid=target.rowid"; | WHERE source.rowid=target.rowid"; | ||
} | } | ||