1、sql count()函数:
count()函数返回匹配指定条件的行数。
sql count(column_name)语法:
count(column_name)函数返回指定列的值的数目(null)不计入。
select count(column_name) from table_name
sql count(*)语法:
count(*)函数返回表中的记录数。
select count(*) from table_name
sql count(distinct column_name)语法:
count(distinct column_name)函数返回指定列的不同值的数目。
select count(distinct column_name) from table_name
比如下面这张表:table_aid
+-----+---------+-------+------------+
| aid | site_id | count | date |
+-----+---------+-------+------------+
| 1 | 1 | 45 | 2016-05-10 |
| 2 | 3 | 100 | 2016-05-13 |
| 3 | 1 | 230 | 2016-05-14 |
| 4 |