Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一张名为products.
products
Products Quantity 5
我需要更新Quantity任何值;例如,将 3 添加到当前值,输出如下:
Quantity
Quantity 8
如何编写 SQL 查询来完成此操作?
update products set quantity = quantity + 3
declare @table table(id int, quantity int) insert into @table values(1, 5) update @table set quantity = quantity + 3 output inserted.quantity
假设您实际上想要输出的值。不要忘记任何可能需要的 where 子句