I am getting this error Too many SOQL queries: 101 for this trigger when I tried to push it into production. Can anybody please tell what is wrong in the script below. I will really appreciate any help.
Trigger
trigger OpenAgingDetailsCount on NRProducts__c (before update) {
for (NRProducts__c np : Trigger.new) {
AggregateResult[] results =[SELECT Count(id)total FROM Aging_Detail__c WHERE (Status__c='New' OR Status__c='In Process') AND NRProducts__c IN :Trigger.new ];
np.Open_Aging_Count__c = (decimal)results [0].get('total');
}
}