The “Query Alias” module allows a superuser to construct
SELECT statements easily by aliasing subqueries. To mimic a typical multi-table database environment this module allows the assignment of an alias to a subquery, then substitutes the subquery into the full query (usually a query with a join) before execution. This allows for easy construction of complex
JOIN queries on the
- This area allows the superuser to choose how many subqueries to alias, how to paginate or return the data when executing, and includes the ability to return a textarea for adhoc queries. The “Submit Full Query” button is the main button which does the subquery substitutions and executes the full query.
- This is the area where the subquery aliases are defined. One of the best ways to alias a subquery is to choose a string surrounded by brackets (ie
- Put the subquery in this area for each alias. Typical subqueries are like (
SELECT * FROM data_table WHERE row_type = 1). Do not terminate the subquery with a semicolon.
- This is where the full query is constructed, use the aliases like regular tables in this area. A query might look like this (
SELECT t1.columns, T2.columns FROM [aliasname1] T1 INNER JOIN [aliasname2] T2 ON t1.keys = T2.keys ...