sql里将A表的第一行数据的金额加10,其他行金额不变,写一个查询

如题所述

数据库里没有第一行一说,你要指定某行需要一个主键(也就是能唯一区分不同行的那个字段),通常来说都有一个自增长的列,假定是ID,那更新这一行金额就是(假定金额字段叫money,表名叫table1,第一行ID是1)
update table1 set money=money+10 where id=1
温馨提示:答案为网友推荐,仅供参考
第1个回答  2018-08-08
update table set money=money+10 where id=(select id top(1) from table);
自己可以加order by