Home > Database > Mysql Tutorial > body text

mysql 根据某个字段只取限制数量的数据问题

WBOY
Release: 2016-06-06 09:39:52
Original
1323 people have browsed it

mysql

我限制数据是这样的

产品表
有平台id 产品名称

id ptid name
1 100 产品1
2 100 产品2
3 100 产品3
4 100 产品4
5 100 产品5
6 100 产品6
7 101 产品7
8 101 产品8
9 101 产品9
10 101 产品10
11 101 产品11

如何根据某个平台id 只取这个平台的3条数据(顺序可以随机)

id ptid name
1 100 产品1
2 100 产品2
3 100 产品3
7 101 产品7
8 101 产品8
9 101 产品9

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!