查询数据库,其中我的日期字段少于31天 [英] Query Database where my date field is less than 31 days
本文介绍了查询数据库,其中我的日期字段少于31天的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是数据库查询的新手。我正在使用访问权限,尝试查询我的数据库,其中字段成员日期不到31天。我想也许DateDiff功能可行但我不确定如何正确使用它。
我将不胜感激任何帮助。谢谢
I am new to database queries. I am using access, trying to query my database where the field memberdate is less than 31 days old. I thought maybe the DateDiff function would work but I''m not sure how to use it correctly.
I would appreciate any help. Thanks
推荐答案
我是数据库查询的新手。我正在使用访问权限,尝试查询我的数据库,其中字段成员日期不到31天。我想也许DateDiff功能可行但我不确定如何正确使用它。
我将不胜感激任何帮助。谢谢
I am new to database queries. I am using access, trying to query my database where the field memberdate is less than 31 days old. I thought maybe the DateDiff function would work but I''m not sure how to use it correctly.
I would appreciate any help. Thanks
试试这个:
Try this:
展开 | 选择 | Wrap | 行号
对不起我猜我应该对此进行更多扩展。谢谢你顺便回复。我使用它来使用asp登录网站上的一个部分。我的sql语句只选择符合条件的记录:
set rscheck = my_conn.Execute(" Select * from member where email =''"& email& ;"''和密码=''"&密码&"''AND memberdate =''" DATEDIFF(日,[memberdate],GETDATE()< 31"''")
Sorry I guess i should have expanded on this a bit more. Thank you for your reply by the way. I am using this to login to a section on a website using asp. my sql statement to select only the records that meets the criteria is:
set rscheck = my_conn.Execute ("Select * from member where email=''" & email & "'' and password=''" & password & "'' AND memberdate=''"DATEDIFF(Day, [memberdate], GETDATE() < 31"''")
对不起我想我应该对此进行更多扩展。谢谢你顺便回复。我用这个来登录网站上使用asp。我的sql语句只选择符合条件的记录的部分:
set rscheck = my_conn.Execute(" Select * from member where email = ''"& email&"''and password =''"& password&"''AND memberdate =''" DATEDIFF(Day,[memberdate],GETDATE()< 31" ;''")
Sorry I guess i should have expanded on this a bit more. Thank you for your reply by the way. I am using this to login to a section on a website using asp. my sql statement to select only the records that meets the criteria is:
set rscheck = my_conn.Execute ("Select * from member where email=''" & email & "'' and password=''" & password & "'' AND memberdate=''"DATEDIFF(Day, [memberdate], GETDATE() < 31"''")
这是更新的查询
Here is the updated query
展开 | 选择 | Wrap | 行号
这篇关于查询数据库,其中我的日期字段少于31天的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文