This question has already been answered:

Prompt the correct query in SQL to count the number of rows with a null value of NULL.

Reported as a duplicate by members Mike , Denis , aleksandr barakin , Grundy , Firepro 12 Sep '16 at 9:25 .

A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .

    2 answers 2

    As an option, though never the best:

    SELECT COUNT(*) - COUNT(someField) FROM someTable 
    • Thank you very much! everything is working! - Carol
     SELECT COUNT(*) from Sometable where SomeField is null 
    • Thank! And how can I add this query to a longer query, where I not only count zeros, but also rows with values ​​from several connected tables - Carol
    • Query request: SELECT Campaign, Budget_spent, count (*) AS "Number of users", count ([1 month later]) as "Number of paid users", FROM User_source JOIN Campaigns ON replace ((User_source.dump), ' ' , '-') like ('% cpn-' || Campaigns.campaign_no || '%') JOIN Payments ON replace ((User_source.dump), ' ', '-') like ('% -u' || Payments.user_id || '%') - Carol
    • when using WHERE they give out a syntax error - Carol
    • And what a mistake? - iluxa1810 pm