Query with indirect path

I have a query that I can get to work if I type the path directly, but when I get the path information from a tag, it throws an error. I cant figure out what it thinks is wrong, other than it keeps getting the literal text of the string instead of the value of the tag at that address. I've tried several things and I'm sure its a simple solution, but it won't get the tag value, just the path.

Exception: Error running query:
SQLQuery(query=SELECT step, description, type, jointID, variations, pageNum FROM inverterworkinstructions
WHERE stationNum = 1
AND pageNum = [default]StationTags/PowerT/Inverter/aaStation1/station/pageNum
ORDER BY step, database=FF_Test_DB)@5000ms
On: InverterStation_1 (1).Root Container.TablePages.data
caused by GatewayException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '[default]StationTags/PowerT/Inverter/aaStation1/station/pageNum
ORDER BY step' at line 4
caused by MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '[default]StationTags/PowerT/Inverter/aaStation1/station/pageNum
ORDER BY step' at line 4

Ignition v7.9.2 (b2017041315)
Java: Oracle Corporation 1.8.0_121

Here is the non working :

SELECT step, description, type, jointID, variations, pageNum FROM inverterworkinstructions
WHERE stationNum = {Root Container.Station Name.StationNumber}
AND pageNum = [default]{Root Container.Station Name.dataPath}station/pageNum
ORDER BY step

And the working query:

SELECT step, description, type, jointID, variations, pageNum FROM inverterworkinstructions
WHERE stationNum = {Root Container.Station Name.StationNumber}
AND pageNum = {[default]StationTags/PowerT/Inverter/aaStation1/station/pageNum}
ORDER BY step

I believe it has to do with the squiggly brackets, but every time I try to insert them it has a different error. Something about finding an open bracket instead of a closed bracket.

You can’t do this in one binding. You will need another property to contain the desired tag value (via an indirect binding) and then include this property in your query.