1. 程式人生 > >thinkphp 按指定欄位統計資料條數

thinkphp 按指定欄位統計資料條數

 $shops = $Table->field('id , count(weekday) as num')->where($where)->group('weekday')->select();

結果
Array( 
[0] => Array ( 
[id] => 1 
[num] => 3 

[1] => Array (
[id] => 2 
[num] => 3       
  )