Variable name part of a topic 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 /^macchina’ with a machine number it works very well,

someone can help me?