You need to sign in to do that
Don't have an account?
Most Recent Records in the LIst
Hi All
I have a SOQL Query which returns me following results of Product in a LIST
Select Account__c,Order_Status__c, Case_Number__c, Product_Description__r.Is_Package__c, Product_Description__r.Name
From Order_History__c
1. Name : Branding Last Modified: 06/28/13
2. Name : AHL Last Modified: 06/2/13
3. Name : CHAT Last Modified: 06/28/13
4. Name : Branding Last Modified: 06/29/13
5.Name: CHAT Last Modified: 06/27/13
In the above list i have two similar product names i just want to get most recent modified Product Name. I want my list to look like
1. Name : AHL Last Modified: 06/2/13
2. Name : CHAT Last Modified: 06/28/13
3. Name : Branding Last Modified: 06/29/13
hOW DO I MODIFY MY QUERY TO GET THE ABOVE RESULT
You can use the order by clause
Select Account__c,Order_Status__c, Case_Number__c, Product_Description__r.Is_Package__c, Product_Description__r.Name
From Order_History__c Order By name ASC,LastModifiedDate DESC
Yeah but it would just order the list in Descending order of Last Modified Date .
I just need most recent of the 2 identical Products. If there are 2 CHATs and 2 Brandings I just need one.
You have use apex to eliminate the duplicate records.