How does PHPmysql query the number of different values of a field? for example, 
The car table has a pinpai field, 
There are 6 Lambo, Audi, BMW, Audi, Toyota, and Lambo values, 
This field has four different brands and six vehicles. 
How can we obtain the value 4 and the value 6? 
The front-end shows: "There are a total of 6 vehicles of four brands. " 
------------------------------------------------------------------------- 
 
Please give me a complete SQL select statement. I am a newbie, practical, and experienced driver. 
-------------------------------------------------------------------------- 
Do not copy and paste 
Select pinpai from car group by pinpai and select distinct pinpai from car 
It's not what I want to answer, because they lack quantity. 
 
 
 
 
 
 
 
 
 
 
 
Reply to discussion (solution) 
 
 
create temporary table car (pinpai varchar(10));insert into car values ('Lambo'),('Audi'),('BMW'),('Audi'),('Toyota'),('Lambo');select pinpai, count(*) as cnt from car group by 1 
pinpai cnt Audi   2 BMW    1 Lambo  2 Toyota 1 
 
 
You don't understand what I mean. you are not the result. I want to display the display at the front desk: "There are four types of vehicles, a total of six. "Instead of displaying the number of each brand
 
 
 
 
 
create temporary table car (pinpai varchar(10));insert into car values ('Lambo'),('Audi'),('BMW'),('Audi'),('Toyota'),('Lambo');select pinpai, count(*) as cnt from car group by 1 
pinpai cnt Audi   2 BMW    1 Lambo  2 Toyota 1 
 
You don't understand what I mean. you are not the result. I want to display the display at the front desk: "There are four types of vehicles, a total of six. "Instead of displaying the number of each brand 
 
Use group by + count.
 
Select pinpai, count (*) as num from car group by pinpai;
 
 
 
select count(*) pinpai, sum(cnt) as cnt  from (select pinpai, count(*) as cnt from car group by 1) T
 
pinpai cnt 4      6 
 
You do not know any database knowledge at all? 
 
 
 
 
 
select count(*) pinpai, sum(cnt) as cnt  from (select pinpai, count(*) as cnt from car group by 1) T
 
pinpai cnt 4      6 
 
You do not know any database knowledge at all?