數(shù)據(jù)遞增
$item = StatisticsPlatform::firstOrCreate([
'day' => LmTime::dayStart($date),
]);
$item->update([
'order_create' => \DB::raw('order_create + 1'),
$order_create_platform => \DB::raw($order_create_platform . '+ 1'),
]);
數(shù)據(jù)求和
$total = StatisticsPlatform::select([
\DB::raw('SUM(register_total) as register_total'),
\DB::raw('SUM(register_pc) as register_pc'),
\DB::raw('SUM(register_android) as register_android'),
])->get();
根據(jù)條件求多條數(shù)據(jù)某個(gè)字段的和
$lock_money = FinanceLock::where('account_id', $item->account_id)
->where('lock_type', '!=', 'unlock')
->sum('amount');
一次更新多條數(shù)據(jù)的相應(yīng)字段值
FinanceRebate::whereIn('activity_id', $arr)
->update([
'can_apply'=> 1
]);
根據(jù)兩個(gè)字段的和或差選取數(shù)據(jù)
$items = BeMonitorNotify::where(\DB::raw('(unix_timestamp(now())-unix_timestamp(updated_at)-exec_time)'), '>', 0)
->get();
去除重復(fù)值
$items = FinanceLock::groupBy('account_id')->lists('account_id')->toArray();
未完待續(xù)段化。咙轩。。