【发布时间】:2023-02-06 18:40:30
【问题描述】:
我想在特殊情况下用 MySQL 或 Go 更新结果:
原始数据:
id parent_id grade_id
test admin
test1 test
test2 test
test3 test1
test4 test
需要更新grade_id的一列:
id parent_id grade_id
test admin
test1 test admin
test2 test admin
test3 test1 test
test4 test admin
根据资料,如果test的parent id不为null(parent id为admin),则下一个test1的年级id为admin,其余同理。
【问题讨论】:
-
我没有看到一个实际的问题。你能用你正在尝试的代码更新你的问题,并准确解释它是如何不按预期工作的吗?