I'm using a CTE and in my main query I need to include a predicate in the where clause comparing a value from the projection
CommonTableExpression<Record4<Integer, Long, BigDecimal, Integer>> cte = name("rnkd")
.fields("rt", "acct", "bal", "rnk")
rank().over().partitionBy(a.TRANSIT, a.ACCT).orderBy(a.BALANCE_DATE.desc()))
.from(a)
);
create.with(cte)
.select(cte.field("rt"), cte.field("acct"), cte.field("bal"))
.from(cte)
.where(cte.field("rnk").eq(1L))
.fetch();
But I cant do that because cte.field("rnk") returns Field<?>. I was hoping to see an overload where I could pass in the type so I could write the predicate like:
cte.field("rnk", Long.class).eq(1L)
But no luck there either. Do I have any better option other than just doing: DSL.field("rnk", Long.class).eq(1L) ?
It's not a big deal to call field directly -- I just figured it might be convenient to have a field overload to pass in the type. Are there any risks here? I guess its a CTE so its not like a quoted table where I care about the fully qualified name...
Steve