Time Series Panel: Getting 0 instead of NULL if using select without group by

Using Grafana v.9.2.0 in Windows, hitting a MSSQL database.

If I select with only sorting by time, I get the wrong result. Each timestamp/ChannelName combination is assigned a value. If the original data record does not contain a value, it is filled with “0” instead of NULL.

SELECT
dateTime as time,
ChannelName as metric,
value
FROM …
WHERE …
ORDER BY
dateTime asc;
0InsteadOfNull
I tried Transform “Prepare time series” (multi-frame time series), but it did not help.

If I do the grouping in mssql
SELECT …
max(value)

GROUP BY
dateTime,
ChannelName

It is working properly, but with inapropriate performance.
image

If I format the query into a table and perform the Transform “Grouping to Matrix” with column “Metric”, row “Time” and cell value “Value”, this is what I would expect from Grafana to plot the time series.

=> What do I have to do to get the correct series without using Group By in MSSQL?

I had to cast the float-Value to a precise number with less digits. This worked for me:
SELECT
dateTime as time,
ChannelName,
cast(value as decimal(5,3)) as wert
FROM