I am trying to filter out the
null values of
Id related to the corresponding child contacts in the following query, but it is not happening.
When I update the
active__c checkbox field in the contact object for the record which doesn't have any associated parent account
Id in the
Account object, The column
Count(Account.Name) is giving the problem by returning the
null record having 0 value.
SELECT Account.Id, Count(Account.Name) Namecount FROM Contact WHERE Active__c = true AND Account.Id != NULL AND Account.Name != NULL GROUP BY Account.Id ORDER BY Account.Id
The same query when I run separately in the query editor is working fine and giving the expected results. (only Non zero Non-null values)
But, when I use this same query inside the SOQL in apex method, it is returning the Null values also(0 count record), and the output is impacted.
Can anyone please suggest how to get rid of these null value records inside SOQL queries?