Returns a subset from the start of a set, using the current order of the set.
This function returns a set
HEAD(set_expression, optional_integer_expression, optional_sample_flag)
The default value for this argument is 1.
The function uses this argument to determine the number of elements to return in the subset.
This optional flag has an effect only in the case where the set_expression
contains multiple nested CROSSJOIN
expressions. In such cases, by default, the system does not attempt to determine the subset until set_expression
has been fully evaluated and all the set elements are known. If you include the optional_sample_flag
, the system truncates the results as each CROSSJOIN
is evaluated; this approach can be considerably faster but can result in a subset that contains fewer elements than given by the optional_integer_expression
Note that when you use drag and drop actions in the Analyzer to create queries that use the HEAD function for a set that contains multiple nested CROSSJOIN
expressions, the Analyzer automatically adds this flag.
This function returns a set that consists of the specified number of elements from the start of the given set (considering the current order of the set). If integer_expression
is less than 1, the function returns the empty set. If integer_expression
is greater than the number of elements of the set, the function returns the original set.
The elements of the subset are returned in the same order specified by the original set.
SELECT MEASURES.[%COUNT] ON 0, HEAD(birthd.decade.MEMBERS, 3) ON 1
1 1910s 71
2 1920s 223
3 1930s 572