Linking tamplate variables

I have around 100 pairs of servers that I would like to create a dashboard for that is templated as they occasionally come and go and it would be nice to just make a change to a single panel when I need to modify something.

How do I create a templating variable such that I can call $serverA and $serverB in a panel or row and guarantee that they are appropriately paired per the data source? I am primarily using MySQL for my datasource.

I have tried creating variables like so

$serverA = select distinct serverA
$serverB= select distinct serverB where partner= $serverA

This works as long as I filter down to a single $serverA with the variable drop down but obviously stops working when I change it to include multiple servers. Is there any way to accomplish this?

I’m on 6.6.1 open to updating further. I would move heaven and earth to update to 7 it if you could have a variable table and repeat for rows with variables being the column headers.