I have database named testing
and I create table named countme
++++++++++++++++++++++++
++ ID +++ Click ++++++++
++ 1 +++ 10 +++++++++++
++ 2 +++ 8 +++++++++++
++ 3 +++ 2 +++++++++++
++ 4 +++ 21 +++++++++++
How to count column Click
and display it.
Try this SQL
SELECT SUM(`Click`) AS total FROM `countme`
You can use SUM()
in SQL statement,
select SUM(Click) as ClickTotal from countme
Ref: http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html#function_sum
You can use Mysql sum()
function.
Example:
SELECT SUM(`Click`) FROM countme