在JOOQ中,我可以像下面这样写SQL代码吗?
我不知道如何编写具有多个字段的in谓词。
select some_value
from t1
where (t1.id1, t1.id2) in ((1, 2), (1, 3), (2, 1))发布于 2018-06-28 18:01:47
您正在寻找DSL.row()构造函数。另请参阅:https://www.jooq.org/doc/latest/manual/sql-building/conditional-expressions/in-predicate-degree-n
在你的案例中,写下:
DSL.using(configuration)
.select(T1.SOME_VALUE)
.from(T1)
.where(row(T1.ID1, T1.ID2).in(row(1, 2), row(1, 3), row(2, 1)))
.fetch();一如既往:
// This static import is implied
import static org.jooq.impl.DSL.*;https://stackoverflow.com/questions/51075203
复制相似问题