I'm trying to create a query for my Aerospike database, that would return the highest value in a specific bin; similar to the way that the MAX() function works in MySQL. For example, if I had a set like this:
+--------------+---------+
| filename | version |
+--------------+---------+
| alphabet.doc | 4 |
| people.doc | 2 |
| alphabet.doc | 6 |
| people.doc | 3 |
+--------------+---------+
What I need is to only return the filename with the highest version number. At the moment I can add a filter like this:
stmt := db.NewStatement(DBns, DBset, "filename", "version")
stmt.Addfilter(db.NewEqualFilter("filename", "alphabet.doc"))
// run database query
records := runQuery(stmt)
Anyone know how to do this?