Fill previous irregular data

Hello community,

Im dealing with irregular data, so i have a query (query_1) that fill seconds where there is no value with previous. the query is working fine just the problem that if there is non previous it returns null.

*** query_1 = “select mean(value) as mv from measure where time > ‘2020-02-01T04:09:00Z’ and time < ‘2020-02-01T04:16:00Z’ group by time(1s),tag_id fill(previous)” ***

So to deal with null i have another query that returns the last value for each tag_id

*** query_last = “SELECT last(value) FROM measure WHERE time < ‘2020-02-01T04:09:00Z’ group by tag_id” ***

what i want in the end its to fill null values i get from the first query with value that i will get with the second query based on tag _id as a commun tag.

Do you have any idea how to resolve that ? do you have any help

I simply think that’s not possible.

You could set a greater time interval in the grouping, in order to avoid too much filling and then set a static value for FILL, ie: FILL(0)