你好,我正在努力重写这是jooq,有人能帮我吗?
SELECT t.id,
t.count,
@running_total := @running_total + t.count AS cumulative_sum
FROM TABLE t
JOIN (SELECT @running_total := 0) r
ORDER BY t.id发布于 2018-02-05 17:11:29
jOOQ目前还不支持这种特定于MySQL的现成语法,但是您可以通过plain SQL templating API轻松解决缺少的任何jOOQ特性
// Assuming you're using the code generator
MyTable t = MY_TABLE.as("t");
DSL.using(configuration)
.select(
t.ID,
t.COUNT,
field("@running_total := @running_total + {0}", t.COUNT).as("cumulative_sum"))
.from(t)
.crossJoin(select(field("@running_total := 0")))
.orderBy(t.ID)
.fetch();https://stackoverflow.com/questions/48582693
复制相似问题