我如何编写一份更新声明,为一年中第一年编写的所有发票的发票的信用总额字段增加100?
我试图写一个如下声明:
Update dbo.invoices
set credittotal (this is the problem right here where i dont know how to add 100 to this)
where invoices = (the first of the year)
答案 0 :(得分:3)
添加100意味着列的新值将是当前值加上100:
UPDATE dbo.invoices
SET credittotal = credittotal + 100
WHERE DATEPART (dy, invoices) = 1