How can I combine a table name to a select query?

  • Goal:
    Whenever I click on an item in the listbox, I want to complete the select query using the value of the clicked element as a table name.

  • Steps:I wrote the following query :
    SELECT
    COUNT(*)
    FROM {{listbox_exchange.value}}

And I expect the query to be completed and executed as follows:
SELECT
COUNT(*)
FROM stock_nyse

But I only get the following error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''stock_nasdaq'' at line 3

Plaease help me to get a correct result

1 Like

The first error shows to disable prepared statements. You can yo go the resource page and click on your mysql resource to config. At the bottom you will see a checkbox to disable prepared statements.

2 Likes

You solved the problem!! Thank you.
It was a perfect solution for me

2 Likes

Perfect, im glad you solved the issue