SQL日期更新问题:) [英] Sql date updating question :)
问题描述
图书馆数据库:
CheckedOut col in Loan table:2015-08-27 04:43:40
目标是:
使得DueDate像CheckedOut + 7天
= 2015-09-03 04:43:40
SQLite语言
在这种情况下,我想通过添加7天更新日期列
我该如何处理?< br $> b $ b
非常感谢:)
我的尝试:
图书馆数据库:
CheckedOut col in Loan table:2015-08-27 04:43:40
目标是:
使得DueDate像CheckedOut + 7天
= 2015-09-03 04:43:40
< blockquote>尝试:
更新 MyTable SET DueDate = DATEADD(dd,< span class =code-digit> 7 ,CheckedOut) WHERE ...
或者:
INSERT INTO MyTable(CheckedOut,DueDate,...) VALUES GETDATE(),DATEADD(dd, 7 ,GETDATE()),...
library database:
CheckedOut col in Loan table: 2015-08-27 04:43:40
TARGET IS :
make the DueDate like CheckedOut+ 7 days
=2015-09-03 04:43:40
in DB Browser SQLite language
in this case, I want to update the date column by adding 7 days
how could I deal with this?
many thanks :)
What I have tried:
library database:
CheckedOut col in Loan table: 2015-08-27 04:43:40
TARGET IS :
make the DueDate like CheckedOut+ 7 days
=2015-09-03 04:43:40
Try:UPDATE MyTable SET DueDate = DATEADD(dd, 7, CheckedOut) WHERE ...
Or:
INSERT INTO MyTable (CheckedOut, DueDate, ...) VALUES GETDATE(), DATEADD(dd, 7, GETDATE()), ...
这篇关于SQL日期更新问题:)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!