java - Selecting conditions with jooq -
in sql, can execute query of type:
select cost > 1000 above_k, name products;
giving me list:
+---------+--------+ | above_k | name | +---------+--------+ | true | gold | | false | silver | +---------+--------+
how can model similar query using jooq
? cannot (obviously):
ctx.select(tables.products.cost.gt(1000))
since, there no method select(condition condition)
. or if wanted to:
select cost*0.9 discounted_cost products;
is there way using jooq?
sql 1:
select cost > 1000 above_k, name products;
jooq 1:
ctx.select(field(products.cost.gt(1000)).as("above_k"), products.name) .from(products) .fetch();
sql 2:
select cost*0.9 discounted_cost products;
jooq 2:
ctx.select(products.cost.mul(0.9).as("discounted_cost")) .from(products) .fetch();
Comments
Post a Comment