Address js Array Variables in SQL

Here's a really easy question to answer (I hope) but slightly more difficult to write...

If I take the output from a Retool SQL query and format it as an array and use that array to populate a js array variable, can I then use that array variable as an entity within subsequent Retool SQL queries?

In simple terms, can I use js array variables as temporary tables?

Here's the js that I'm using to populate the array variable:

await variable1.setIn(formatDataAsArray(query1.data));

Hey Adam! You should definitely be able to use values from a SQL query in another SQL query.

I wonder if something like additionalScope would help. That would allow you to trigger a query and pass in the result of another query.

Here's a guide on how additionalScope works:

https://community.retool.com/t/how-to-use-additional-scope-additionalscope-in-your-queries/13343

Here's an example of a user who may have a similar use case to yours:

https://community.retool.com/t/passing-value-in-additionalscope-from-one-postgresql-query-to-another/22817