[:find (max ?tuple) :where [?k :kid/age ?age] [?k :kid/name ?name] [(vector ?age ?name) ?tuple]
Note:
the order of the attributes in the expression (vector ?age ?name) matters
the query returns one result, while we can expect a collection, because there can be many children in the age who are maximum in the set. You can use (max n ?tuple) to achieve this.
See also the Returning Aggregates section at http://docs.datomic.com/query.html
If you have something more specific, provide more details in the question and include your circuit.
source share