You can certainly do that, but probably not with AQL. You would want to use an ‘Aerospike Expression’ Aerospike Expressions | Aerospike Documentation in some kind of language that supports it Client Matrix | Developer Hub
AQL is more of a small troubleshooting tool unfortunately and there are many features it lacks many users expect