I can't query previously queried tables!

For some reason, I can’t even do a simple query of a previously queried table. Here is the query and the error:

We have other apps that use EXACTLY the same syntax and they work. But for some reason I can’t get ANY of my queries of previous queries to work.

Help please!

Hi @mathfour! Welcome to the community! :grinning:

What type of query is this? Typically you’ll see this type of error when you use a dynamic table name inside of a SQL Resource query (mssql, mysql, etc). If you select Resource type “Query JSON with SQL,” it should allow you to run this query.

This query works:

This query also works, since the table name is hard coded and the dynamic value is in the where clause:

If query1 is a SQL query, you may also need to format the data using {{formatDataAsArray(query1.data)}}. Let us know if you have questions! You can also read more about this in our docs: https://docs.retool.com/docs/sql-queries#security

2 Likes

Thanks, Tess!

Turns out I was trying to query with the Resource selected as a database, not “Query JSON with SQL.”

But now that I know, I’m a querying machine!

:wink: