我想做类似以下的事情(在Sql Server中):
update person set numItems += @num, today = @updateDate where id = @id
我知道" numItems + = @ num"语法不正确,如何编写该部分?
答案 0 :(得分:2)
SQL Server没有+=
表示法,因此只需将其完全展开
update person set numItems = numItems + @num, today = @updateDate where id = @id
答案 1 :(得分:1)
某些数据库确实支持+=
。但是,以下是标准SQL:
update person
set numItems = numItems + @num,
today = @updateDate
where id = @id;