Ms Access中的DATE和Max函数 [英] DATE and Max Functions in Ms Access
本文介绍了Ms Access中的DATE和Max函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好.
我有一个表,其中有一个名为Year.this的字段,可以接受任何年份
当我想检索当前年份的记录时,请使用以下内容:DatePart("yyyy",Now()).可以,因为它检索了当年的正确记录.现在我想要使用Max函数的替代方法.我问这个问题,因为这是一个学年,又与另一年重叠,因此"DatePart("yyyy",Now())将不是理想的
hello guys out there.
I have a table that has a field called Year.this accepts any year
When i want to retrieve records with the current year i use the following: DatePart("yyyy",Now()). This is ok as it retrieves the correct records for the year. Now i want an alternative to this using Max function.Am asking this because this is a school year which overlaps into another year hence the"DatePart("yyyy",Now())" will not be an ideal
推荐答案
要获取年份的唯一集合,请使用以下查询:
To get unique collection of years, use this query:
SELECT DISTINCT [Year]
FROM Table1
要获得年份的最大值:
To get max of year:
SELECT MAX([Year]) AS MaxOfYear
FROM Table1
这篇关于Ms Access中的DATE和Max函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文