You need to sign in to do that
Don't have an account?
Tillu
How to retrive records which are not in list?
I have Contact as master and policy as detailed. i want retrive records other than this list..
List<contact> cp = [select id,Customer_Producer__c from contact]; //this is contact List
List<Policy__c> pList1 = [select id,IssueDate__c from Policy__c where Contact_1__c IN: cList]; // Records of policy under contact
List<Policy__c> pList2 = [select id,IssueDate__c from Policy__c where Contact_1__c IN: cList And NotIn pList1]; // I want to retrive otherthan records of pList1. I have written for just to understand.
You can create a new List as
List<Policy__c> pList3 = [select id,IssueDate__c from Policy__c where ID <>:pList1 ];
All Answers
You can create a new List as
List<Policy__c> pList3 = [select id,IssueDate__c from Policy__c where ID <>:pList1 ];
Hi Anvesh,
See the links might help,
Comparing Values between two lists
http://salesforce.stackexchange.com/questions/9910/comparing-values-between-two-lists
Checking to see if a value is present in a list - Apex
http://salesforce.stackexchange.com/questions/4218/checking-to-see-if-a-value-is-present-in-a-list-apex
Regards,
Ashish