laravel中selectRaw查询

laravel中如何使用selectRaw和group by

```
selectRaw('id+tag_id as id_tag_id')->selectRaw("concat(id,'---',tag_id) as cnt")->where('tag_id',$id)->get();
echo "

";
print_r($data->toArray());

$data = Table::select(\DB::raw('DATE(created_at) as year, COUNT(*) as amount'))->where('tag_id',$id)->groupBy(\DB::raw('date(created_at)'))->first();
echo "

";
print_r($data->toArray());

?>
```

    A+
发布日期:2021年04月20日  所属分类:未分类

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: