2011-07-12 58 views
5

我想檢索01-01-2011和06-30-2011之間創建的機會。Soql查詢檢索兩個日期之間的機會

Select o.CreatedDate, o.Id, o.LastModifiedDate 
from Opportunity o 
where o.CreatedDate > '1/1/2011' and o.CreatedDate < '12/31/2011' 
order by o.LastModifiedDate 

因爲CREATEDATE是一個日期時間我得到一個錯誤說createdDate爲datetime,不應該用引號括起來。

有人可以幫助如何讓這個查詢工作。我只是想獲得它的頂點Explorer中運行該查詢,這不是頂點代碼的一部分

回答

9

SOQL查詢兩個日期之間檢索的機會:

Select o.CreatedDate, o.Id, o.LastModifiedDate 
from Opportunity o 
where o.CreatedDate > 2011-01-01T00:00:00Z and o.CreatedDate < 2011-12-31T00:00:00Z 
相關問題