The count should be 3 and 1 in the following query. The count should be of the points earned consecutively. So once the user fails to earn any points, the count restarts.
mysql> select name, count(*) from sortest group by name, (points = 0) OR (points is NULL) having name= 'john';
+------+----------+
| name | count(*) |
+------+----------+
| john | 4 |
| john | 2 |
+------+----------+
2 rows in set (0.00 sec)
mysql> select * from sortest;
+----+------+--------+
| id | name | points |
+----+------+--------+
| 1 | john | 12 |
| 2 | john | 23 |
| 3 | john | 43 |
| 4 | hari | NULL |
| 5 | hari | 56 |
| 6 | john | NULL |
| 7 | hari | 0 |
| 8 | john | 44 |
| 9 | john | 0 |
| 10 | hari | 43 |
| 11 | hari | 44 |
| 12 | hari | 78 |
| 13 | hari | 0 |
+----+------+--------+
13 rows in set (0.00 sec)
mysql> show create table sortest\G
*************************** 1. row ***************************
Table: sortest
Create Table: CREATE TABLE `sortest` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(100) default NULL,
`points` int(11) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=14 DEFAULT CHARSET=latin1
1 row in set (0.00 sec)
In this case, john's count should be 5, 1 and 2
5 and 1 because it ends with 0 or NULL and 2 because it has not yet closed with the 0 or NULL
mysql> select * from sortest;
+----+------+--------+
| id | name | points |
+----+------+--------+
| 1 | john | 12 |
| 2 | john | 23 |
| 3 | john | 43 |
| 4 | hari | NULL |
| 5 | hari | 56 |
| 6 | john | NULL |
| 7 | hari | 0 |
| 8 | john | 44 |
| 9 | john | 0 |
| 10 | hari | 43 |
| 11 | hari | 44 |
| 12 | hari | 78 |
| 13 | hari | 0 |
| 14 | john | 55 |
| 15 | john | 95 |
+----+------+--------+
15 rows in set (0.00 sec)
mysql> select name, count(*) from sortest group by name, (points = 0) OR (points is NULL) having name= 'john';
+------+----------+
| name | count(*) |
+------+----------+
| john | 6 |
| john | 2 |
+------+----------+
2 rows in set (0.00 sec)