How to Calculate Multiple Aggregate Functions in a Single SQL Query
blog.jooq.org