Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 如何知道查询中的最短日期?_Sql_Postgresql_Select_Postgresql 9.1 - Fatal编程技术网

Sql 如何知道查询中的最短日期?

Sql 如何知道查询中的最短日期?,sql,postgresql,select,postgresql-9.1,Sql,Postgresql,Select,Postgresql 9.1,我有一个列,上面有各种日期作为时间戳 “2014年1月17日08:25:13” “2014年1月17日08:15:11” “2014年1月17日09:55:12” “2014年1月17日08:45:01” 如何查询最早的日期?或者: select min(stamp) from tbl 或: 如果需要在整个集合上使用第一个,而不进行分组,则第一个也可以用作 如果您需要邮票上的日期,请将其转换为: select min(stamp::date) from tbl 或: select min

我有一个列,上面有各种日期作为时间戳

“2014年1月17日08:25:13”

“2014年1月17日08:15:11”

“2014年1月17日09:55:12”

“2014年1月17日08:45:01”

如何查询最早的日期?

或者:

select min(stamp) from tbl
或:

如果需要在整个集合上使用第一个,而不进行分组,则第一个也可以用作

如果您需要邮票上的日期,请将其转换为:

select min(stamp::date) from tbl
或:

select min(stamp::date) from tbl
select stamp::date from tbl order by stamp asc limit 1