持つ(連鎖操作10)


having メソッドにはパラメーターが 1 つだけあり、文字列のみを使用できます。例:

Db::table('score')
    ->field('username,max(score)')
    ->group('user_id')
    ->having('count(test_time)>3')
    ->select();

生成される SQL ステートメントは次のとおりです:

SELECT username,max(score) FROM score GROUP BY user_id HAVING count(test_time)>3