Trying to get a count of records(records more than 50000 in object) in one object through apex class(Getting limit Exception). Looking for any alternate solution.
I used database.countQuery()statement, but still I am getting records limit exception.
Any one give me alternate solution to get records count.
My query is dynamic query like:
String s = 'Case';
String soql = 'SELECT COUNT() FROM' + s;
Integer cnt = Database.countQuery(soql);
select count(id) from Lead
in the query editor and it returned 433316.