-
Notifications
You must be signed in to change notification settings - Fork 308
Open
Labels
InfluxDB v3InfluxDB v3.0 (platforms using IOx)InfluxDB v3.0 (platforms using IOx)SQLgood-first-issueEasy update. Good for first timers!Easy update. Good for first timers!
Description
I've been trying to work out how to filter my results to those which have a timestamp of all of yesterday
.
The docs talk about now()
as a way to find today's date, but after that all the examples which SELECT
a date range all use static timestamps. It is possible to write a query that will always return the results from all of yesterday
without specifying the timestamps in the WHERE
clause.
For example; this will filter to times that are in the range of all of yesterday
(NB: I don't know if this is the correct way to do it, but it works for me, I think):
WHERE time > DATE_TRUNC('day', now()-interval '1 day') AND time < DATE_TRUNC('day', now())
I think this is a valuable example and users would benefit from an example of how to do it.
Relevant URLs
- https://docs.influxdata.com/influxdb/cloud-iox/reference/sql/functions/time-and-date/
- Provide other relevant URLs (project issues, community threads, etc.)
Metadata
Metadata
Assignees
Labels
InfluxDB v3InfluxDB v3.0 (platforms using IOx)InfluxDB v3.0 (platforms using IOx)SQLgood-first-issueEasy update. Good for first timers!Easy update. Good for first timers!