Nested Queries in the Source List
You can use a nested query as a source table in the list of sources. In this case, the source description contains a description of the nested query. Description of a nested query is composed in the same manner that is used for a regular query.
Using a nested query as a data source is not different from using an infobase table. All the fields described in the selection fields list of the nested query are accessible as fields of such a source.
Example:
Select
Reference, Nomenclature, QuantityFrom
(
Select First 8
Reference, Nomenclature, QuantityFrom
Document.ExpInvoice.Contents
)
As NestedQuery
Query result:
Reference
Nomenclature
Quantity
Invoice 00007 date February 25, 2002 21:03:21
Women's jeans
4
Invoice 00006 dated February 25, 2002 0:00:00
Women's jeans
5
Invoice 00006 dated February 25, 2002 0:00:00
"Cowboy" shirt
5
Invoice 00005 dated March 01, 2002 20:58:28
Women's jeans
1
Invoice 00004 dated March 01, 2002 20:50:40
Women's jeans
1
Invoice 00003 dated February 23, 2002 0:00:00
"Aquarium" bathroom
5
Invoice 00003 dated February 23, 2002 0:00:00
"Lilia" sink
8
Invoice 00003 dated February 23, 2002 0:00:00
"Ultra" mixer
10