查询唯一字段值的最新记录 [英] Query most recent records for unique field values
问题描述
你好 -
我有点麻烦。我想创建一个查询,该查询将返回查询中某个字段中所有唯一值的最新记录(按日期)。我也将从3个不同的表中提取数据。由于我的描述通常不充分,这里有一个简单的例子:
查询之前:
日期字段
1/1/07 A
1/2/07 A
1/2/07 B
1/2/07 C
1/3/07 A
1/4/07 B
查询后:
日期字段
1/3/07 A
1/4/07 B
1/2/07 C
这有意义吗?有一个简单的解决方案吗?
对于一个表,解决方案将是
展开 | 选择 | Wrap | 行号
嘿那里,
i正在寻找我的问题的解决方案并且遇到了这个讨论。这是我遇到的确切问题。
我想从状态子表单中提取最近的日期。拉动项目名称从它的主要形式。
我尝试使用Max(Date)来获取最近的日期,但它只会拉出1/4/07 B。这是所有日期中的最新日期,而不仅仅是B。日期。 (来自上图)
i尝试将它与主表匹配,但这也不起作用:S
有什么建议吗?
嘿那里,
i正在寻找我的问题的解决方案并且遇到了这个讨论。这是我遇到的确切问题。
我想从状态子表单中提取最近的日期。拉动项目名称从它的主要形式。
我尝试使用Max(Date)来获取最近的日期,但它只会拉出1/4/07 B。这是所有日期中的最新日期,而不仅仅是B。日期。 (来自上图)
我也尝试将它与主表匹配,但这也不起作用:S
有什么建议吗?
尝试使用DMax。
= DMax(" [Date]"," TableName"," [name] =''"& [Forms]![MainFormName]![name]&"''")
Hello-
I''m having a little trouble. I want to create a query that will return the most recent records (by date) for all unique values in a certain field in the query. I''ll be pulling data from 3 different tables as well. Since my description is usually inadequate, here''s a simple example:
Before Query:
Date Field
1/1/07 A
1/2/07 A
1/2/07 B
1/2/07 C
1/3/07 A
1/4/07 B
After Query:
Date Field
1/3/07 A
1/4/07 B
1/2/07 C
Does that make sense? Is there a simple solution?解决方案For one table the solution would be
Expand|Select|Wrap|Line Numbers
hey there,
i was searching for solutions to my problem and came across this discussion. this is the EXACT problem i am having.
I want to pull the most recent date from the "status subform" pulls the project "name" from its main form.
I tried using Max(Date) to get the most recent date, however it only pulls "1/4/07 B" which is the latest of ALL the dates, not just he "B" dates. (from above illustration)
i tried matching it to the main table as well but that isn''t working either :S
Any suggestions?
hey there,
i was searching for solutions to my problem and came across this discussion. this is the EXACT problem i am having.
I want to pull the most recent date from the "status subform" pulls the project "name" from its main form.
I tried using Max(Date) to get the most recent date, however it only pulls "1/4/07 B" which is the latest of ALL the dates, not just he "B" dates. (from above illustration)
i tried matching it to the main table as well but that isn''t working either :S
Any suggestions?Try using DMax.
=DMax("[Date]","TableName","[name]=''" & [Forms]![MainFormName]![name] & "''")
这篇关于查询唯一字段值的最新记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文