请帮我执行此查询
id FDeviceName FDeviceType
1 case mini
2 rack b
3 amir d
4 rack a
5 case max
6 case mini
我希望这个查询回来
id FDeviceName FDeviceType count
1 case mini 2
2 rack b 1
3 amir d 1
4 rack a 1
5 case max 1
答案 0 :(得分:1)
SELECT MIN(id), FDeviceName, FDeviceType, Count(Id)
FROM tablename
GROUP BY FDeviceName, FDeviceType
ORDER BY 1;
应该产生你所要求的,假设id是一个字段
答案 1 :(得分:0)
SELECT id, FDeviceName, FDeviceType, COUNT(*) FROM Table GROUP BY FDeviceName, FDeviceType