0

请帮我执行这个查询

 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
4

2 回答 2

1
SELECT MIN(id), FDeviceName, FDeviceType, Count(Id)
  FROM tablename
  GROUP BY FDeviceName, FDeviceType
  ORDER BY 1;

应该产生你所要求的,假设 id 是一个领域

于 2013-02-06T12:53:37.793 回答
0
SELECT id, FDeviceName, FDeviceType, COUNT(*)  FROM Table GROUP BY FDeviceName, FDeviceType
于 2013-02-06T12:54:08.013 回答