问题
Most of the existing posts I can find dealing with my learning jook are outdated.
I'm trying to build dynamically so that I can use conditions for certain changes. I'm trying to find how to add COUNT(*)
to an existing list of fields
SelectQuery query = create().selectQuery();
query.addSelect(TABLE.FIELD);
// add COUNT(*)?
I'm not seeing any methods or API help on how to do this when building the query dynamically.
回答1:
Just use DSL.count()
query.addSelect(count());
The above is assuming a static import as such:
import static org.jooq.impl.DSL.*;
来源:https://stackoverflow.com/questions/19849839/add-count-as-select-field-using-jooq-selectquery