Home > Database > Mysql Tutorial > body text

SQL中Group分组获取Top N 方法实现

WBOY
Release: 2016-06-07 17:43:34
Original
1000 people have browsed it

有产品表,包含id,name,city,addtime四个字段,因报表需要按城市分组,统计每个城市的最新10个产品,便向该表中插入了100万数据,做了如下系列测试: . ( ( 1 , 1 ) NOT NULL , ( 50 ) NULL , , ( 10 ) NULL , ( ) , IGNORE_DUP_KEY , ALLOW_PAGE_LOCKS )

有产品表,包含id,name,city,addtime四个字段,香港服务器,因报表需要按城市分组,统计每个城市的最新10个产品,便向该表中插入了100万数据,做了如下系列测试:

.( (1,1) NOT NULL, (50) NULL, , (10) NULL, ( ), IGNORE_DUP_KEY , ALLOW_PAGE_LOCKS ) ,美国空间,香港服务器租用

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template