Variable name, change at run-time in mqtt

my variable is part of the topic that i need to query different values from my database influx,

I defined this variable of name: M1, with label machine
SELECT value FROM “sensors_mqtt_consumer” WHERE (“topic” = ‘/id_machine’)
this query return the numbers of my machines

so to be able to select a different value i really would like to write something like this, but i dont work
i really dont understand why

SELECT value
FROM “sensors_mqtt_consumer”
WHERE (“topic” = ‘/^macchina’/info/Vacuum_Current ')

if i change write (“topic” = ‘/2/info/Vacuum_Current ')
it works very well, i need to change that number at run-time with the variable so the query will resolve differents data.

someone can help me?