我正在尝试将一些数据从一个表插入另一个表但我需要在将数据插入第二个表之前根据记录增加日期。我的SQL语句如下所示:
sql = "INSERT INTO WPReadinessMasterTbl SELECT WPReadinessEntriesTbl.RequiredDate FROM WPReadinessEntriesTbl WHERE ProjectType= " & ProjectType
db.Execute (sql)
我需要在记录进入之前将WPReadinessEntriesTbl.RequiredPrepDays添加到WPReadinessEntriesTbl.RequiredDate。如何轻松完成此操作?
答案 0 :(得分:0)
您可以使用 DateAdd :
sql = "INSERT INTO WPReadinessMasterTbl " & _
"(YourFieldname) " & _
"SELECT DateAdd('d', WPReadinessEntriesTbl.RequiredPrepDays, WPReadinessEntriesTbl.RequiredDate) " & _
"FROM WPReadinessEntriesTbl " & _
"WHERE ProjectType = " & ProjectType & ""