GROUP consistent operation method is also one of the methods typically used in conjunction with aggregate functions, grouping result set according to one or more columns.
group a single parameter, and only string.
For example, we all query results are grouped according to statistics user id:
$this->field('username,max(score)')->group('user_id')->select();
Generated SQL statement is:
SELECT username,max(score) FROM think_score GROUP BY user_id
Also supports a plurality of packet fields, for example:
$this->field('username,max(score)')->group('user_id,test_time')->select();
Generated SQL statement is:
SELECT username,max(score) FROM think_score GROUP BY user_id,test_time