How to select records from last 24 hours using SQL?

后端 未结 11 2153
Happy的楠姐
Happy的楠姐 2020-12-04 04:41

I am looking for a where clause that can be used to retrieve records for the last 24 hours?

11条回答
  •  执念已碎
    2020-12-04 05:27

    in postgres, assuming your field type is a timestamp:

    select * from table where date_field > (now() - interval '24 hour');

提交回复
热议问题