开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜