惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
The GitHub Blog
The GitHub Blog
F
Fortinet All Blogs
Cloudbric
Cloudbric
P
Palo Alto Networks Blog
T
Threatpost
T
Tor Project blog
T
Tenable Blog
AWS News Blog
AWS News Blog
Project Zero
Project Zero
L
LangChain Blog
Cyberwarzone
Cyberwarzone
Engineering at Meta
Engineering at Meta
雷峰网
雷峰网
C
CERT Recently Published Vulnerability Notes
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Security Latest
Security Latest
云风的 BLOG
云风的 BLOG
I
Intezer
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
P
Proofpoint News Feed
A
Arctic Wolf
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Google DeepMind News
Google DeepMind News
V
Vulnerabilities – Threatpost
C
Cybersecurity and Infrastructure Security Agency CISA
MongoDB | Blog
MongoDB | Blog
aimingoo的专栏
aimingoo的专栏
K
Kaspersky official blog
Jina AI
Jina AI
N
News | PayPal Newsroom
T
The Blog of Author Tim Ferriss
D
DataBreaches.Net
A
About on SuperTechFans
博客园 - 三生石上(FineUI控件)
博客园 - 【当耐特】
Hugging Face - Blog
Hugging Face - Blog
Recorded Future
Recorded Future
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
S
Secure Thoughts
TaoSecurity Blog
TaoSecurity Blog
P
Privacy & Cybersecurity Law Blog
P
Proofpoint News Feed
MyScale Blog
MyScale Blog
IT之家
IT之家
Forbes - Security
Forbes - Security
The Hacker News
The Hacker News
Last Week in AI
Last Week in AI
T
Threat Research - Cisco Blogs
Y
Y Combinator Blog

博客园 - netcorner

docker 启动报错 library initialization failed - unable to allocate file descriptor table - out of memory docker容器访问上层宿主主机的方式 svn: Server SSL certificate verification failed certificate issued for a different hostname springboot 参数校验 windows批处理 打开exe后关闭cmd input[type="file"] change事件第二次不触发 小程序post请求,后台接收不到数据的解决方法 Docker安装Kibana Docker安装ElasticSearch Docker安装Redis Docker安装Tomcat Docker安装 Nginx mysql服务设置远程连接 解决1251 client does not support ..问题 Docker 安装MySQL容器 安装Docker 图形界面管理工具 -- Portainer Dockfile 编写示例(将 jar 制作成容器) Docker 常用命令集 云服务器CentOS安装Docker CentOS7离线安装Docker
分页得到查询总数的方法 mysql
netcorner · 2021-06-25 · via 博客园 - netcorner

比如说有段sql需要取出一张表的前10行,同时又需要取出符合条件的总数。这在某些翻页操作中很常见

SELECT SQL_CALC_FOUND_ROWS * FROM tbl_name
WHERE id > 100 LIMIT 10;

在上一查询之后,你只需要用FOUND_ROWS()就能获得查询总数,这个数目是抛掉了LIMIT之后的结果数:

SELECT FOUND_ROWS();

其中第一个sql里面的SQL_CALC_FOUND_ROWS不可省略,它表示需要取得结果数,也是后面使用FOUND_ROWS()函数的铺垫。

posted @ 2021-06-25 10:54  netcorner  阅读(1463)  评论(0)    收藏  举报