我正在尝试对 sql 表进行大规模更新,但我不理解逻辑等价物。我想要用伪代码做的是:
UPDATE mytable
SET mycolumn = (pull down the datetime from mycolumn2. if the year of that datetime is not equal to 2013, then mycolumn = 24. if the year is 2013, then mycolumn = 24 - number of months in that datetime)
我只是真的不确定从哪里开始在 SQL 中实现这种逻辑。有人对我有任何提示或方向吗?
谢谢