File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -179,6 +179,24 @@ public function testUpdate(): void {
179
179
'UPDATE `t` SET `c` = 1 WHERE rowid IN ( SELECT rowid FROM `t` ORDER BY `c` ASC LIMIT 1 ) ' ,
180
180
'UPDATE t SET c = 1 ORDER BY c ASC LIMIT 1 '
181
181
);
182
+
183
+ // UPDATE with multiple tables.
184
+ $ this ->assertQuery (
185
+ 'UPDATE `t1` SET `id` = 1 FROM `t2` WHERE `t1`.`c` = `t2`.`c` ' ,
186
+ 'UPDATE t1, t2 SET t1.id = 1 WHERE t1.c = t2.c '
187
+ );
188
+
189
+ // UPDATE with JOIN.
190
+ $ this ->assertQuery (
191
+ 'UPDATE `t1` SET `id` = 1 FROM `t2` WHERE `t1`.`c` = 2 AND `t1`.`c` = `t2`.`c` ' ,
192
+ 'UPDATE t1 JOIN t2 ON t1.c = t2.c SET t1.id = 1 WHERE t1.c = 2 '
193
+ );
194
+
195
+ // UPDATE with JOIN using a derived table.
196
+ $ this ->assertQuery (
197
+ 'UPDATE `t1` SET `id` = 1 FROM ( SELECT * FROM `t2` ) AS `t2` WHERE `t1`.`c` = 2 AND `t1`.`c` = `t2`.`c` ' ,
198
+ 'UPDATE t1 JOIN ( SELECT * FROM t2 ) AS t2 ON t1.c = t2.c SET t1.id = 1 WHERE t1.c = 2 '
199
+ );
182
200
}
183
201
184
202
public function testDelete (): void {
You can’t perform that action at this time.
0 commit comments