jooq聚合函数 [英] jooq aggregate functions
问题描述
我正在尝试在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.*;
- http://www.jooq.org/doc/最新/手动/入门/教程/ jooq-in-7-steps / jooq-in-7-steps-step6 /
- > http://www.jooq.org/doc/latest/manual/getting-started/the -manual /
- http://www.jooq.org/doc/latest/manual/getting-started/tutorials/jooq-in-7-steps/jooq-in-7-steps-step6/
- http://www.jooq.org/doc/latest/manual/getting-started/the-manual/
- 静态导入
org.jooq.impl.DSL.max
- 完全符合查询条件中的
DSL.max
- static import
org.jooq.impl.DSL.max
- fully qualify
DSL.max
in your query
因此,您要运行的示例将要求您要么
Hence, the example you're trying to run will require that you either
这篇关于jooq聚合函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!