i have two query first one is returning null values :
SELECT COUNT(id) FROM Lead WHERE LastActivityDate = Null
Secoend one is returning not null values:
Acctully i am creating dashboard in VF page thats why i need a query who calculate the LastActivityDate null and not null values and show them in a pie chart so please use GROUP BY LastActivityDate .Thanks and RegardsBharat SharmaSELECT COUNT(id) FROM Lead WHERE LastActivityDate != Null
1 answer
Hi Bharat,I think that you are not using the correct return type for the query that you have written. If you want to use Count(Id), then you should use the following query ->AggregateResult[] groupedResults = [SELECT Count(Id)idc FROM Lead WHERE LastActivityDate = Null];Object countid = groupedResults[0].get('idc');Where 'countid' will return the number of Leads where the value of 'LastActivityDate' field is null.And if you want an Integer return type, then use this simple query ->Integer j = [SELECT Count() FROM Lead WHERE LastActivityDate != Null];Where 'j' will return the number of Leads where the value of 'LastActivityDate' is not null;Regards,Ajay