The CARDINALITY
row function takes a set and returns the number of elements in that set.
CARDINALITY
function is:
CARDINALITY(<set>)
where set is a set of any set data type (such as mdex:string-set
or mdex:long-set
). For example, set can be a multi-assign double attribute.CARDINALITY example
RETURN results AS SELECT WineID AS id, CARDINALITY(Body) AS numBody FROM WineState WHERE WineID < 7 ORDER BY id
id numBody --------- | 1 | 0 | | 2 | 0 | | 3 | 2 | | 4 | 2 | | 5 | 4 | | 6 | 1 | ---------
The numBody column shows the number of elements in the Body set for each record.