我的表格如下所示:
| userId | level |
-------------------
| snoop | 10 |
| foo | 0 |
| bar | 0 |
我想将所有用户的级别更新为snoop级别。
我知道我可以获得价值并且去:
update table set level = 10
但是如果我不想硬编码值10并且需要在一个查询中执行此操作,我该怎么做?
谢谢!
答案 0 :(得分:0)
update table
set level = (select level from table where userId = 'snoop')