比如是这样的数据
a
a
a
b
b
c
要查询这样的结果
a 3
b 2
c 1
SQL语句这样写
SELECT SNAME ,COUNT(*) ICOUNT FROM TABLE GROUP BY SNAME ORDER BY ICOUNT DESC
例:
select fileformat, count(fileformat) as icount from gallery group by fileformat;
比如是这样的数据
a
a
a
b
b
c
要查询这样的结果
a 3
b 2
c 1
SQL语句这样写
SELECT SNAME ,COUNT(*) ICOUNT FROM TABLE GROUP BY SNAME ORDER BY ICOUNT DESC
select fileformat, count(fileformat) as icount from gallery group by fileformat;