lundi 5 octobre 2015

What's the correct and optimized way to "Group By" and "Max" or "most recent" values with ORMLite?

What's the correct and most optimized way to "Group By" and "Max" or "most recent" values of field? (with ORMLite preferably)

I want to "group by" results but getting the most recent value from a field of date type.

something like:

-- records:

1, hello, 1985
2, hello, 1991
3, hello, 1990
4, hello world, 2015
5, hello world, 2010
6, hello world, 2000

i should get after running the query/ormlite functions something like this:

-- results grouping by string field and the most recent value of year:

2, hello, 1991
4, hello world, 2015

Aucun commentaire:

Enregistrer un commentaire