Query Chaining
Query chaining enables analysts to reference the results of a query from other queries.
#
SyntaxReference other queries by writing the query name inside ${ }
.
For example, if you want to reference a query named daily_sales
, you would write ${daily_sales}
into your SQL query.
#
ExampleHere we have a normal SQL query, called sales_by_region:
Next, we have a query calculating average sales across regions, which references sales_by_region using the ${ }
syntax.
Below is the compiled SQL that's sent to the database:
#
PresentationYou can choose whether you want to see the compiled or written SQL inside the query viewer:
#
OtherThe order that queries appear on the page doesn't matter to the SQL compiler. You can reference queries that appear before or after the query that you are authoring.
The SQL compiler detects circular and missing references. If a query includes either a circular reference or a missing reference, Evidence will display an error that looks like a syntax error in a normal SQL query. Queries with compiler errors are not sent to your database.