MySQL 在一个查询中获得 mindate 和 maxdate
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8727936/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 22:14:06 来源:igfitidea点击:
MySQL get mindate and maxdate in one query
提问by Timo Huovinen
How to get the maxmum date and minimum date in mysql using only one sql query?
如何仅使用一个 sql 查询在 mysql 中获取最大日期和最小日期?
回答by Icarus
Select min(date_col),max(date_col) from table_name
回答by Joseph Nields
JUST IN CASE someone came here looking for minimum and maximum supporteddates like I did... here's the answer to your question :)
以防万一有人来这里寻找像我一样的最小和最大支持日期......这是你问题的答案:)
select
DATE('1000-01-01') MinDate,
DATE('9999-12-31') MaxDate
+------------+------------+
| MinDate | MaxDate |
+------------+------------+
| 1000-01-01 | 9999-12-31 |
+------------+------------+