GroupBy support #40

markwillis82 opened this Issue Nov 17, 2011 · 2 comments


None yet
2 participants


I can't seem to find in the documentation ( how to perform a groupby (without running a raw statement) is this something planned for future release?

tomasm- commented Mar 6, 2012

You can do GROUP BY (or anything else arbitrary) with the .add() chain:

db.query().select("COUNT(*)").from("messages").add(" GROUP BY user_id").execute();

Just make sure you put a space BEFORE the GROUP BY, as it doesn't do it for you (it will look like "FROM messagesGROUP BY...")

tomasm- commented Mar 6, 2012

NOT to confuse "add()" with "and()".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment