6.

count / max / average (集計)

編集

本稿はLaravelのクエリビルダーを用いた集計関数の使用方法をまとめた記事です。

 

count

$users = DB::table('users')->count();

 

max

$price = DB::table('orders')->max('price');

 

avg(average)

$price = DB::table('orders')->avg('price');

 

編集
Post Share
子ページ

子ページはありません

同階層のページ
  1. SELECT
  2. INSERT
  3. UPDATE
  4. DELETE
  5. order by句のキャスト
  6. count / max / average (集計)
  7. 配列を条件にする方法
  8. where句の入れ子(ネスト)