Show values in a variable depending on another variable

Hi, I need a variable that shows the results of another variable
i tried with

select * from table
where field1 = ~/$variable1/

what i saw in a video tutorial but i cant make it works, if you can help me i would apprecciate you so much

pd: here is the video in question (min 5:14)

pd2: i’m using postgresql

hello what version are you using?

hi im using the grafana 7.1

helo can you upgrade to latest version ?