The algorithm that selects data from query source tables is defined using the query language.
A query text can include several parts:
- Query definition
- Query union
- Ordering query result
- Description of totals
The only mandatory part is the first one, the query definition. All the other parts are optional.
A query definition specifies data sources, selection fields, groupings, and so on.
A query union specifies how the results of several queries are merged.
Ordering query result specifies how query result rows are ordered.
Autoordering enables automatic ordering of query result rows.
Description of totals specifies which totals are calculated in the query and how the results are grouped.
Note that when the query language is used to describe data sources in the data composition system, the description of totals query part is not used because the data composition system calculates the totals on its own based on the settings provided by the developer or by the user.
The query language syntax structures are described in detail in the built-in Designer help.
To open the built-in help
- On the Help menu, click Help contents.
- In the help contents, open section 1C:Enterprise / Script / Working with queries.
Another source of information about query language syntax is chapter "Work with Queries" of the 1C:Enterprise Developer Guide.
We will discuss the query language in more detail later, during the creation of specific reports.
You will not create any queries manually. For the majority of reports developed using the data composition system, you can create a query using the query wizard.
Your goal for this lesson is to learn how to read and understand query text, so that you can edit queries in the future.