Equivalent to $__timeGroup(dateColumn,‘5m’, 0) in MySQL

I would like to know what is the equivalent to $__timeGroup(dateColumn,‘5m’, 0) in MySQL. I am specifically interested about the part that makes missing values to be 0.

I know that something like unix_timestamp(concat(DATE_FORMAT(dateColumn, '%Y-%m'), '-01')) as time can be used. But this does not cover the cases when the value is missing.

Do you mean equivalent sql? The actual filling of missing points are done in Grafana backend when using the $__timeGroup macro function.

Yes I mean pure sql.
I thought so because the generated SQL of __timeGroup(_, _, 0) and __timeGroup(_, _) are the same.
Any ways for pure sql?

The reason for this being implemented in backend was due to we didn’t find any pure SQL solution and/or solution with good performance. If possible, maybe you could implement some kind of function that could help, but I’m just guessing here.