gpt4 book ai didi

android - ORMLITE 中的 SQL MAX-MIN - ANDROID

转载 作者:太空狗 更新时间:2023-10-29 15:34:55 25 4
gpt4 key购买 nike

我想知道如何在 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com