Select data from last month

#1

Hello!

I want to select all data from last month depends on actually date.

Example: today 2018-06-21 -> I need all datas from 2018-05-01 - 2018-05-31

with
SELECT * FROM “” WHERE time >= 1525125600000000000 and time <= 1527803999000000000
I will get it. But the Timerange should variable (depends on “today”)

somthing like this:

SELECT * FROM “” WHERE time = month(today)-1

the last 30 days I will get with time < now() - 30d

Is this possible?

rg
Hansi

#2

I think you should be able to run a query like this:

select * from “” where time <= now() and time >= now() - 30d

#3

Hello
Thank you for replay.
But I need the data from previous month fot for last 30 days().

Like SELECT * FROM “” WHERE time =lastmonth()

rg
Hansi

#4

This is a popular feature request that’s on our radar, and will be supported in our new query engine, Flux.

#5

Thank you for Information

rg
Hansi

1 Like