Problem when using variables in SQL query

I am encountering issues when I am trying to use variables in SQL query.

I have the following query:

driver_trips is the table which has tripId that I want to inject in the query, but joining is not required.

Field filters don’t work with aliased table names. As you’re using a subquery, there’s not much you can do about it other than change the filter type to Text or Number, then change your query to ID={{ID}}