我想知道如何在 ORMLITE 中使用 MAX MIN 命令。
例如假设我们有这张表
Table Name = Example
Column 1 = id
Column 2 = name
在 ORMLITE 中我如何获得最大 ID?我看了here但我没有完全理解..
谁能给我看看 ORMLITE 中 Max min 的例子?
最佳答案
QueryBuilder<Account, Integer> qb = accountDao.queryBuilder();
qb.selectRaw("MIN(orderCount)", "MAX(orderCount)");
// the results will contain 2 string values for the min and max
results = accountDao.queryRaw(qb.prepareStatementString());
String[] values = results.getFirstResult();
我从 documentation 找到了这个
关于android - ORMLITE 中的 SQL MAX-MIN - ANDROID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19044910/