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 Answer 1


You can use condition like below,

WHERE Flight_Start_Date1__c > LAST_QUARTER

For more details regarding date literals refer below link,


  • 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, 2015 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, 2015 at 15:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .