使用同一 table 中另一行的数据查询更新行

Query Update row with data from another row in the same table

我有 table 这样的...有 3000 多条记录..

╔═════╦════════╦═════════════╗
║ id  ║  text  ║  parent_id  ║
╠═════╬════════╬═════════════╣
║   1 ║  asas  ║           0 ║
║   2 ║  fgh   ║           0 ║
║   3 ║  jkl   ║           0 ║
║   4 ║  kkk   ║           0 ║
║   5 ║  test  ║           0 ║
║   6 ║  asd   ║           0 ║
║   7 ║  dsa   ║           0 ║
╚═════╩════════╩═════════════╝

如何将 parent_id 值更改为相同的 ID?喜欢这个...

╔═════╦════════╦═════════════╗
║ id  ║  text  ║  parent_id  ║
╠═════╬════════╬═════════════╣
║   1 ║  asas  ║           1 ║
║   2 ║  fgh   ║           2 ║
║   3 ║  jkl   ║           3 ║
║   4 ║  kkk   ║           4 ║
║   5 ║  test  ║           5 ║
║   6 ║  asd   ║           6 ║
║   7 ║  dsa   ║           7 ║
╚═════╩════════╩═════════════╝

还有更多……直到 3000 多条记录……

就这么简单:

update yourtable set parent_id = id