查询和日期字段 [英] Queries and Date Fields

查看:54
本文介绍了查询和日期字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我经常遇到这个问题,我希望有人可以向我解释。 Access是否始终将文本输出到查询中,无论表格中的数据格式是什么?


我通常需要按日期查询,然后将输出限制在特定日期范围。我再次遇到问题,我想知道是否因为在执行查询后字段不再是日期格式。因此,当我包括之间(2006年1月11日)和(11/30/2006)之间在Criteria字段中,它没有给我任何回报。


我正在处理一个非常简单的查询。这是查询的SQL语言的副本:


SELECT Transactions.Date,Transactions.Card1,Transactions.TransTotal

FROM Transactions;


我非常感谢任何解释和建议。

谢谢!

I constantly have problems with this and I am hoping someone can explain it to me. Does Access always output text into a query regardless of what the formating of the data is in the table?

I am generally needing to query by date and then confine the output to a specific date range. Once again I am having problems and I am wondering if it is because the field is no longer in date format after the query is performed. So when I include the "Between (11/1/2006) And (11/30/2006)" in the Criteria field it gives me no returns.

I am working with a very simple query. Here is a copy of the SQL language of the query:

SELECT Transactions.Date, Transactions.Card1, Transactions.TransTotal
FROM Transactions;

I would greatly appreciate any explanations and suggestions.
Thank you!

推荐答案


我经常遇到这个问题,我希望有人可以向我解释。 Access是否始终将文本输出到查询中,无论表格中的数据格式是什么?


我通常需要按日期查询,然后将输出限制在特定日期范围。我再次遇到问题,我想知道是否因为在执行查询后字段不再是日期格式。因此,当我包括之间(2006年1月11日)和(11/30/2006)之间在Criteria字段中,它没有给我任何回报。


我正在处理一个非常简单的查询。这是查询的SQL语言的副本:


SELECT Transactions.Date,Transactions.Card1,Transactions.TransTotal

FROM Transactions;


我非常感谢任何解释和建议。

谢谢!
I constantly have problems with this and I am hoping someone can explain it to me. Does Access always output text into a query regardless of what the formating of the data is in the table?

I am generally needing to query by date and then confine the output to a specific date range. Once again I am having problems and I am wondering if it is because the field is no longer in date format after the query is performed. So when I include the "Between (11/1/2006) And (11/30/2006)" in the Criteria field it gives me no returns.

I am working with a very simple query. Here is a copy of the SQL language of the query:

SELECT Transactions.Date, Transactions.Card1, Transactions.TransTotal
FROM Transactions;

I would greatly appreciate any explanations and suggestions.
Thank you!



指定之间(2006年1月11日)和(11/30/2006)之间作为Criteria告诉查询引擎搜索该特定字符串而不是日期范围。您没有提及是否收到数据类型不匹配错误的事实告诉我您的日期字段被定义为文本而不是日期/时间。搜索给定范围的日期字段的标准将是#11/1/2006#和#11/30/2006#。但是,必须将基础字段定义为日期/时间,以确保准确的结果。

Specifying "Between (11/1/2006) And (11/30/2006)" as a Criteria tells the Query Engine to search for that specifc String and not a Date Range. The fact that you did not mention if you received a Data Type Mismatch Error tells me that your Date Field is defined as Text and not Date/Time. The Criteria for searching a date Field for a given range would be Between #11/1/2006# And #11/30/2006#. The underlying Field, however, must be defined as Date/Time in order to assure accurate results.


谢谢!那很有效。因此,我可以放心地执行查询不会更改日期字段的格式吗? (我试图提高我对Access的理解。)


此外,现在这个工作我似乎有另一个问题。我想按日期对来自查询的数据进行分组。我已经将第一列设置为分组,将第二列设置为总和,但我从2006年12月1日起获得了大约10个条目。我是否需要做其他事情才能让他们参加聚会?
Thank you! That worked. So am I safe to take from this that performing a query does not change the format of the date field? (I am trying to increase my understanding of Access in general.)

Also, now that that is working I seem to have another problem. I want to group the data coming out of the query by date. I have set the first column to group and the second colum to sum and yet I am getting approx 10 entries all from 12/1/2006. Do I need to do something else to get them to goup?


这可能会有所帮助(文字日期时间及其分隔符(#)。


这篇关于查询和日期字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆