Well, I came across this post on Google groups. I did further investigation on my own tables and wanted to share a table of information that I created inspired by work already done.
Each query can take up multiple rows in the table.
The row with attribute 0 is the beginning of the query.
The row with attribute 1 indicates the type of the query.
- Flag value 1 = SELECT query.
- Flag value 2 = SELECT ... INTO query, or a make table query. Name1 will have the name of the table that is created.
- Flag value 3 = INSERT query; Name1 will have the name of the table to insert to.
- Flag value 4 = UPDATE query
- Flag value 5 = DELETE query
- Flag value 6 = Crosstab query (TRANSFORM)
- Flag value 9 = UNION query
The rows with attribute 2 (there could be multiple) are each formal parameter of the query. The Flag column indicates the data type (i.e. "10" for dbText) and the Name1 column indicates the name of the parameter. If there are no rows with attribute 2, then the query does not have formal parameters.
The row with attribute 3 indicates the presence of UNION or DISTINCT keywords.
- Flag value 0 = Nothing special
- Flag value 1 = UNION ALL
- Flag value 2 = SELECT DISTINCT
- Flag value 3 = UNION
- Flag value 8 = SELECT DISTINCTROW
- Flag value 9 = Queries on master fields and child fields
The row with attribute 4 indicates if the query comes from an external database. Name1 will contain the source if attribute 4 exists.
The rows with attribute 5 (there could be multiple) indicate each table found in the query. If the query is a UNION query, the Expression field has a split on the UNION keyword and the Name2 field has a system-generated table alias. For all other tables in a query, Name1 is the name of the table and Name2 is the alias, if there is one.
The rows with attribute 6 (there could be multiple) indicate each single field or expression in the query. If there is no attribute 6 for the query, the behavior assumed is that all fields are included. The Expression field contains each field expression or name, and Name1 contains the field alias if there is one.
- Flag value 0 = Value of the field or expression
- Flag value 1 = The field is a column heading in a crosstab query.
- Flag value 2 = The field is a row heading in a crosstab query.
The rows with attribute 7 (there could be multiple) indicate each single join "ON" expression. The Expression field contains the actual join expression. Name1 contains the first table in the join. Name2 contains the second table in the join.
- Flag value 1 = Inner Join
- Flag value 2 = Left Join
- Flag value 3 = Right Join
The row with attribute 8 contains the whole WHERE clause in the Expression field. If there is no where clause, attribute 8 is omitted from the query.
The rows with attribute 9 (there could be multiple) indicate each single Group By expression in the GROUP BY clause of the query. The Expression field contains each group by expression.
- Flag value 0 = Value of the field or expression
- Flag value 1 = The field is a column heading in a crosstab query.
- Flag value 2 = The field is a row heading in a crosstab query.
The rows with attribute 11 (there could be multiple) indicate each single Order By expression in the ORDER BY clause of the query. The Expression field contains each order by expression. Name1 has "D" or "d" to indicate that the sort is done in descending order.
The row with attribute 255 is the end of the query.
I'm not exactly sure what the Order field does, but I did find that it is not Null, and though it sometimes has a value of an empty string, it doesn't always have that value. Empty strings occur on attributes 5, 6, 7, and 9, but it is not always an empty string for those attributes.