jooq聚合函数 [英] jooq aggregate functions

查看:656
本文介绍了jooq聚合函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在jOOQ中使用诸如max,min之类的聚合函数,并引用其 手动 ,但我不了解他们的示例,他们如何创建max函数并在示例中使用它。你能帮我这个忙吗?

I am trying to use aggregate function like max, min in jOOQ and refering their mannual but I am not understanding their examples that how they created max function and used it in their example. Can you please help me out on this. Please provide simple example if possible.

我面临的问题

在jOOQ中,汇总函数max的人工示例是如下

Problem I am facing
In jOOQ mannual example for aggregate function max is as follows

create.select(max(ID).add(1).as("next_id")).from(T_AUTHOR);

但是当我在查询中使用max时,得到的 function max是不确定的。

but when I used max in my query I am getting function max is undefined.

推荐答案

在jOOQ教程和手册的不同地方记录了静态导入的使用。只要在手册中看到独立功能,就可以安全地假定它是从 org.jooq.impl.DSL

The use of static imports is documented in various places of the jOOQ tutorial and manual. Whenever you see a "standalone function" in the manual, you can safely assume that it was static imported from org.jooq.impl.DSL.

请参见示例

// For convenience, always static import your generated tables and
// jOOQ functions to decrease verbosity:
import static test.generated.Tables.*;
import static org.jooq.impl.DSL.*;



查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆