[英]Sql with window function to JOOQ
I have this query: 我有这个查询:
SELECT id, url, name, email, count(*) OVER() AS overallCount
FROM images
WHERE email = ?
OFFSET ?
LIMIT ?
I'd like to translate it into JOOQ, how could I achieve that? 我想将其翻译成JOOQ,我该如何实现?
Assuming this static import 假设此静态导入
import static org.jooq.impl.DSL.*;
And then 接着
String email = ...
int offset = ...
int limit = ...
using(configuration)
.select(
IMAGES.ID,
IMAGES.URL,
IMAGES.EMAIL,
count().over().as("overallCount"))
.from(IMAGES)
.where(IMAGES.EMAIL.eq(email))
.offset(offset)
.limit(limit)
.fetch();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.