开发者

In Postgres is it possible to retrieve distinct date data if the table only contains the datetime field?

开发者 https://www.devze.com 2023-03-25 22:46 出处:网络
The data is stored as follows 2011-04-29 11:35:24.567 I would like a query SELECT DISTINCT ... That will return data along the lines of

The data is stored as follows

2011-04-29 11:35:24.567

I would like a query SELECT DISTINCT ...

That will return data along the lines of

2011-04-2开发者_Python百科8
2011-04-29
2011-04-30


You just need to cast it as date:

SELECT DISTINCT
    col_name::date
FROM
    table_name
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号