Added support for select=$count in combination with `group`