How do you select a date range in postgres?

后端 未结 2 631
借酒劲吻你
借酒劲吻你 2021-01-07 00:50

I have a timestamp field in a postgres database. I would like to select all dates that have happened within the last month. So something like select * from table where time

2条回答
  •  感动是毒
    2021-01-07 00:59

    To be precise:

    SELECT *
    FROM   tbl
    WHERE  ts_col >  now() - interval '1 month'
    AND    ts_col <= now();
    

提交回复
热议问题