sql - COUNT CASE and WHEN statement in MySQL -


how use count case , when statement in mysql query, count when data null , when not null in 1 mysql query?

use:

select sum(case               when t.your_column null 1              else 0            end) numnull,        sum(case               when t.your_column not null 1              else 0            end) numnotnull   your_table t 

that sum column null & not null entire table. it's need group clause, depending on needs.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -