i collect the state of a parking sensor (0->empty, 1->occupied) and i’d like to know how high is the usage of the given parking spot.
here is where i am right now:
sample line (1 record per second):
SELECT sum(“parking_state”) / 86400 FROM “parkingsensors” WHERE time > now() - 1d
With this, i get the last 24h usage in percent.
What i’d like to get is yesterday’s paying frame usage (e.g. 10:00-18:00)
beyond now() is there a today() or a yesterday() function which gives me an absolute time but changes from day to day?