我正在尝试对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中实现这种逻辑。有没有人对我有任何提示或方向?根据需要
感谢
*** *** SQL只是*结构化查询语言* - 许多数据库系统中使用的语言,而不是AA的数据库产品。 ..很多东西都是特定于供应商的 - 所以我们真的需要知道您正在使用的数据库系统**(以及哪个版本)...... – 2013-03-01 16:46:31
@marc_s我正在使用Microsoft SQL Server 2008 ..对不起 – proseidon 2013-03-01 16:48:03