Language and development rules: Difference between revisions

Jump to navigation Jump to search
m
Tag: 2017 source edit
Tag: 2017 source edit
Line 344: Line 344:
MySQL Syntax:
MySQL Syntax:
<syntaxhighlight lang="sql">
<syntaxhighlight lang="sql">
UPDATE table_taget as target, table_source as source SET fieldtarget=source.fieldsource
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 table_taget as target SET fieldtarget=source.fieldsource
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 table_taget as target SET fieldtarget=source.fieldsource
$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 table_taget as target, table_source as source SET fieldtarget=source.fieldsource
$sql= "UPDATE table_target as target, table_source as source SET fieldtarget=source.fieldsource
WHERE source.rowid=target.rowid";
WHERE source.rowid=target.rowid";
}
}

Navigation menu