¿Cómo contar y recuperar nulo y no nulo en la misma columna en MySQL?
mi mesa
---------------------------------------------------
id | name | visited | registDate |
---------------------------------------------------
1 | george | NULL | 2014-04-01 |
---------------------------------------------------
2 | Thomas | NULL | 2014-04-15 |
---------------------------------------------------
3 | Wilfred | 1 | 2014-04-24 |
---------------------------------------------------
4 | paul | 1 | 2014-04-10 |
---------------------------------------------------
5 | elina | NULL | 2014-05-03 |
---------------------------------------------------
6 | angela | NULL | 2014-04-13 |
---------------------------------------------------
7 | elina | 1 | 2014-05-18 |
---------------------------------------------------
Resultado Esperado
month register visited not visited
---------------------------------------------
05-2014 2 1 1
---------------------------------------------
04-2014 5 2 3
---------------------------------------------
count(visited)
. count (<column>) solo contará no es nulo. Si agrega otro nivel de anidamiento, count_not_visited se puede determinar comocount_registered - count_visited