Ordering within Nested Tables

In the ORDER BY clause, you can define ordering conditions for records from the nested tables; moreover, they can be mixed with ordering conditions for the top-level table.

The order of table fields from one level (nested or top level) relative to each other is important, but the order of table fields from one level relative to another level is not important: ordering always takes place first by the top level table, then by the nested table.

Example:

// Consignment note specifications (the document, assortment and count)
// must be added to the report.
// The documents must be ordered by number,
// the assortment must be ordered by product name.

Select
   Document.ExpInvoice.Reference,
   Dcument.ExpInvoice.Contents.(Nomenclature As Product, Count)

Order By
   Document.ExpInvoice.Number,
   Document.ExpInvoice.Contents.Nomenclature.Name

1C:Enterprise Developer's Community