当前位置:网站首页>Laravel implements groupby to query the number of packets
Laravel implements groupby to query the number of packets
2022-06-26 06:22:00 【Brother, your wig】
How to use laravel To achieve the following sql Well ?
select `book_name`, count(*) as num from `clock_books` group by `book_name`
You can use laravel Original expression for DB::raw() To operate :
$books = DB::table('books')
->select('book_name', DB::raw('count(*) as num'))
->groupBy('book_name')
->get();
||
$users = DB::table('books')
->select(DB::raw('count(*) as num, book_name'))
->groupBy('book_name')
->get();
边栏推荐
猜你喜欢

Message queuing - omnidirectional comparison

技术Leader的思考技巧

低代码实时数仓构建系统的设计与实践

Deeply uncover Ali (ant financial) technical interview process with preliminary preparation and learning direction
Everything is a vector. The service practice of iqiyi online vector recall project

Logstash - logstash sends an alarm email to email

消息队列-功能、性能、运维对比

University Information Management System

vs code 使用 prettier 格式化 js 的时候, 函数定义的名称和括号之间有一个空格, 而 eslit 又不允许这个空格.

TCP連接與斷開,狀態遷移圖詳解
随机推荐
Ppt template crawler case
302. 包含全部黑色像素的最小矩形 BFS
University Information Management System
Data visualization practice: Data Visualization
Transformer中的Self-Attention以及Multi-Head Self-Attention(MSA)
Introduction to canal deployment, principle and use
EFK昇級到ClickHouse的日志存儲實戰
Message queue - function, performance, operation and maintenance comparison
Deeply uncover Ali (ant financial) technical interview process with preliminary preparation and learning direction
Mongodb——使用Mongodb对字段中字符串内容进行截取,并进行分组统计
Understanding of nil in go language
SQL server functions
Library management system
Handwritten background management framework template (I)
Dpdk - tcp/udp protocol stack server implementation (II)
Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedded datasource could
GoF23—建造者模式
numpy. random. choice
TCP connection and disconnection, detailed explanation of state transition diagram
zip(*arg)的用法