Home > Database > Mysql Tutorial > body text

mysql查询不重复的行内容,不重复的记录数count,distinct_MySQL

WBOY
Release: 2016-06-01 13:40:50
Original
1309 people have browsed it

bitsCN.com
mysql查询不重复的行内容,不重复的记录数count,distinct 有这么一个表 记录了id, p_id, p_name , p_content , p_time 1  343        aaa            aaaaaa   2012-09-01 2  344        bbb             bbbbbb 2012-09-02 3  321        ccc             cccccccc 2012-09-03   4 343         aaa             aaaaaa 2012-09-04 想查询不重复的行的内容,并且输出 p_sum ( 产品p_id出现重复的次数) select  *, count(*) as p_sum from p_table_name group by p_name; 查询不重复的行的总行数(好写翻页) select count(distinct p_id) as num from p_table_name;
  bitsCN.com

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!