Querying for specific amount of data

Hi,

this is my first question in this forum so be kind :wink:
My question is, how do I query for a specific amount of data in a given time if this is even possible.
For example i have the timerange of 2 hours and i have a datanode every 5 seconds. That would be 1440 nodes in total. But i just want 500 each time and then send the query again with the time of the last node as a starting point. endtime would still be the same.
So i would get 500, 500, 440 data nodes with 3 requests.

Thx for your answers/ tips in advance :slight_smile:

Greetings Uwe

Since posting my question and no answer i found the solution myself. There is the keyword โ€œlimitโ€ and you can use it to query the specific amount of data you want.
eg:
SELECT * FROM cumulocity_ WHERE deviceId=โ€˜123456โ€™ AND unit=โ€˜Cโ€™ AND time > 1597833036000000000 AND time < 1597833096000000000 limit 1000
would give you the first 1000 values in this timerange. querying the last 1000 values would look like this:
SELECT * FROM cumulocity_ WHERE deviceId=โ€˜2052928โ€™ AND unit=โ€˜Cโ€™ AND time > 1597833036000000000 AND time < 1597833096000000000 order by time desc limit 1000