Expressions from time series and multiple constants returned from a query

Hi, I’m using grafana v10.1.2 (8e428858dd) in a raspberry pi running raspbian bookworm, I have successfully connected a database running on my pi to Grafana and plotted the raw data in a dashboard. Now I want to multiply a time series for a constant, this constant is calculated from 4 values stored in a table in the same row but different columns, I want to use an expression to achieve this. If I generate a query for each value, I can do this without problems, but that means that I would have to have 5 queries for each curve. What I want to do is create a query that gets the 4 constant values and then use subindices in the expression to reference them. Is this possible?
Say my constants query is something like:
SELECT
const0,
const1,
const2,
const3
FROM
My_database.constants
WHERE
name = ‘my_name’
I know that each column returned by this query will only have one value. Then I would like to add an expression like this:
$my_name_timeseries*($my_name_const.const0-$my_name_const.const1)/($my_name_const.const2-$my_name_const.const3)

Does this make any sense? I don’t know where to look for this; any help will be greatly appreciated.