-1

在 mysql 在单个表中,我想删除特定行,并且剩余行必须与 id 一起代替该特定行......我该怎么做?

Id  Name             Title                 order_id     Delete
------------------------------------------------------------------
134 ravi luhar       asp.net developer     1            DELETE
135 ravi luhar       asp.net developer     2            DELETE
4

1 回答 1

0

您可以使用 2 个查询进行处理。首先复制和更新第一行数据,然后删除第二行数据。

UPDATE users AS A
      LEFT JOIN users AS B ON B.id = 135
SET A.name = B.name 
     WHERE A.id = 134;

Delete from users where id=135;
于 2013-03-04T07:06:38.473 回答