Php 从2个字段计数
作为MySQL/PHP Noob,我正在努力解决以下问题: 名为“cars”的表 名为“modell”和“engine”的字段 想写一个问题并得到答案: 以下是:Php 从2个字段计数,php,mysql,count,field,Php,Mysql,Count,Field,作为MySQL/PHP Noob,我正在努力解决以下问题: 名为“cars”的表 名为“modell”和“engine”的字段 想写一个问题并得到答案: 以下是: 2 volvo with 2,0 engine 1 volvo with 2,6 engine 3 saab with 1,8 engine 1 saab with 2,1 engine 1 Chevrolet with 4,2 engine 选择COUNT(*),Model,ENGINE FROM cars G
2 volvo with 2,0 engine
1 volvo with 2,6 engine
3 saab with 1,8 engine
1 saab with 2,1 engine
1 Chevrolet with 4,2 engine
选择COUNT(*),Model,ENGINE FROM cars GROUP BY Model,ENGINE
选择COUNT(*),Model,ENGINE FROM cars GROUP BY Model,ENGINE
2 volvo with 2,0 engine
1 volvo with 2,6 engine
3 saab with 1,8 engine
1 saab with 2,1 engine
1 Chevrolet with 4,2 engine
select modell, engine, count(*) as cnt
from cars
group by modell, engine
SELECT count(*) AS count,
Modell,
engine
FROM cars
GROUP BY Modell,engine