Joining SQL table with Retool table

Hi

I am trying to join an SQL query to a database with a data table i have created within retool.

Below is my query and example data from the table.

SELECT TimeSheetEntries.JobNo, {{table5.Machine}}
FROM TimeSheetEntries
INNER JOIN {{table5}} ON {{table5.Operation}} = TimeSheetEntries.Operation
WHERE TimeSheetEntries.JobNo LIKE '******' AND TimeSheetEntries.Category LIKE 'Cylinder'
{
  "Operation":["PRO_CYLINDER MR","CYLINDERM/R","PRO_CYLINDER CREASE","CYLINDERRUN"],
  "Type":["MR","MR","RUN","RUN"],
  "Status":["Estimate","Actual","Estimate","Actual"],
  "Machine":["Cylinder","Cylinder","Cylinder","Cylinder"]}

I keep seeing variations of the error 'Must declare the table variable "@param2".'

Does anyone have any advice on how to resolve the error?
Thanks in advance

Hi @ESPMatt

Thanks for reaching out! I have a few questions/notes for you --

Is this a Query JSON with SQL query? You can use this query type to join two different sources of data like this:

How is your table data formatted? You may need to reformat the data into an array of objects.

Also, where does {{table5}} come from? If you're referencing the table component, you'll likely need to add .data (table5.data) The available table properties can be found in the left panel of the Retool editor like this: