标签: sql sql-server-2005
我需要将所有issuedat(日期字段)从列paidat(日期字段)更新为不到一个月
issuedat
paidat
前:
if paidat = 01/02/2011 then issuedat should = 01/01/2011 UPDATE invoices SET invoices.issuedat = ????
答案 0 :(得分:4)
UPDATE invoices SET invoices.issuedat = dateadd(MM,-1,paidat)