如何查找时间列的最大值和最小值 [英] how to find max and min value of a time column

查看:290
本文介绍了如何查找时间列的最大值和最小值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello All,



我有一个场景,其中我在表中有一个时间列,noiw我必须找到最大值和最小值根据其他2个colmns的每个员工的日期时间,我正在尝试使用RowNumber()函数...



是对还是其他任何建议。 .. ??

Hello All,

I have a scenario in which i have a column "Time" in a table, noiw i have to find the max and min value of time according to date for eachy employee in 2 other colmns, i am trying to do it using RowNumber() function...

Is it right or any other suggestions...??

推荐答案

尝试:

Try:
SELECT employee, MAX(myDateColumn) AS MaxDate, MIN(myDateColumn) AS MinDate FROM MyTable GROUP BY employee






这个:



Hi,

This :

SELECT [RowID], [EmployeeID], [Access_Date], MIN([Time]) AS MinTime, MAX([Time]) AS MaxTime FROM [TableName] GROUP BY [EmployeeID], [Access_Date]





应该这样做。我在[Access_Date]列中添加了按日期分组的最小和最大时间。

希望这会有所帮助。



should do it. I included the [Access_Date] column to get min and max times grouped by dates.
Hope this helps.


这篇关于如何查找时间列的最大值和最小值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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