In MySQL, get number of pregnant women who received 3 ANC checkups I am working on a project where it is required to find out the total number of pregnant women who have received 3 ANC(Ante-Natal Care) checkups done.

A pregnant women is said to receive 3 ANC checkups if any 3 of the 4 columns(visit1_date,visit2_date,visit3_date and visit4_date) have some value.

For this, I need to calculate the count of number of rows where any 3 of 4 columns given in the table are not null.

So, basically, what is required is to find a count of all rows where any three of 

visit1_date, visit2_date,visit3_date,visit4_date are NOT NULL

My table has columns individually for each of the visit dates

I have tried using IFNULL, but I have no idea if this would help.
Something like (untested):

select *
from &lt;table&gt; 
where if(visit1_date,1,0)+if(visit2_date,1,0)+if(visit3_date,1,0)+if(visit4_date,1,0) &gt;= 3;


should do the trick.