1

I have opportunity summary report in my application which is currently pulling Opportunities whose start date is greater than last quarter's first date. So in my class where condition of my query is-

WHERE Flight_Start_Date1__c >= :lastQuarter.StartDate

But now I want that there should only be one record of the Opp for each Fiscal Qarter, Fiscal Year, and Fiscal Period, with the report displaying the most recently pulled record.Could anyone please suggest what can be WHERE condition to achieve this. Thanks in advance.

1

You can use condition like below,

WHERE Flight_Start_Date1__c > LAST_QUARTER

For more details regarding date literals refer below link,

http://www.salesforce.com/us/developer/docs/officetoolkit/Content/sforce_api_calls_soql_select_dateformats.htm

| improve this answer | |
  • thanks Victor for your reply. Since i want most recent 1 record, so appending this will work ? ORDER BY Flight_Start_Date1__c ASC LIMIT 1 – user19185 May 29 '15 at 6:59
  • If you are looking for latest record, you should ORDER BY Descending order. ORDER BY Flight_Start_Date1__c DESC LIMIT 1 – Victor May 29 '15 at 15:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.