You need to sign in to do that
Don't have an account?
Phani PYDIMARRY 11
SOQL Query to extract same name ,INDUSTRY records or duplicate records
Hello,
I have a unique name which is a number in string format and tracking_code on an object and I there are other duplicate records too with the same combination. I would want to find the records with the same combination to use them somewhere else. Please see my code and let me know if I am doing it right.
I have a unique name which is a number in string format and tracking_code on an object and I there are other duplicate records too with the same combination. I would want to find the records with the same combination to use them somewhere else. Please see my code and let me know if I am doing it right.
List<Account> inaccts = [select ID, name, tracking_code__c from Account where flag__c = false]; map<string, ID> inactiveRecs = new map<string, ID>(); for(Account acc:inaccts ){ inactiveRecs.put(acc.name, acc.code__C); } // I am creating this list to extract exact combination of name and tracking_code for records whose flag is true list<Account> actAccs = [select ID, name, tracking_code__c from Account where flag__c = true AND name in: inactiveRecs.keyset() AND tracking_code__c in inactiveRecs.values() ];
Hi Phani,
I guess you are checking Account with Same Name and SameTracking Code .
Just add check for null pointer for lists as --> inaccts.size() > 0
Add colon for 'tracking_code__c in inactiveRecs.values()'
Thanks,
Sucharita