'Connected Excel to Teradata and added SQL, SQL dependen on Table

I am not sure how to formulate my question but I will do my best.

I have an excel table that I have connected to my Teradata database, and I have put in an SQL that is working without any issues. In my Excel I have said table and it contains dates and a list of names.

Now my question is:

Can I somehow make the SQL statement dependent on the data in the table?

E.g.

Name like Any Table1[[#All],[Surname]]

Is this doable? Would it be easier to put the Teradata connection and SQL into a VBA and from there do the modifications in the SQL code? I am very new on connecting Excel and Teradata, it would be lovely to get some feedback on where I can find more information.

Thanks,



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source