减去1个月更新表SQL Server

时间:2011-10-02 22:06:56

标签: sql sql-server-2005

我需要将所有issuedat(日期字段)从列paidat(日期字段)更新为不到一个月

前:

if paidat = 01/02/2011 then issuedat should = 01/01/2011

UPDATE invoices SET invoices.issuedat = ????

1 个答案:

答案 0 :(得分:4)

UPDATE invoices SET invoices.issuedat = dateadd(MM,-1,paidat)