且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

为每个不同的行选择计数(mysql和php)

更新时间:2023-11-22 15:21:46

select id, count(id)
from table
group by id

如果只想计数id,那么

If only want count of ids, then

select count(id)
from table
group by id

这是有关分组依据子句的简单教程

Here is a simple tutorial of group by clause

http://www.w3schools.com/sql/sql_groupby.asp