I have a table whose structure is as follows:
id int userid int status enum (\'pending\',\'approved\') dop datetime
Data is as:
You sould use the COUNT(DISTINCT()) construction, it allow you to count the diferent values not NULL (docu)
Try this sentence:
SELECT count( DISTINCT( userid ) ) FROM t1 WHERE STATUS = 'pending' GROUP BY userid
HTH!