内容来源于 Stack Overflow,并遵循CC BY-SA 3.0许可协议进行翻译与使用
我想选择SQL:SELECT "year-month" from table group by "year-month" AND order by date,其中日期为“1978-01”、“1923-12”的年份-月格式。
SELECT "year-month" from table group by "year-month" AND order by date
date_part(text, timestamp)
http://www.postgresql.org/docs/8.0/interactive/functions-datetime.html
to_char(timestamp, 'YYYY-MM')
扫码关注云+社区