function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Dave WallinDave Wallin 

query with lastmodifieddate

i cannot seem to use the system field 'lastmodifieddate' in my queries. 
For example: 
SELECT ID FROM Contact WHERE LastModifiedDate BETWEEN 2006-02-02 AND 2006-02-03
 
Is this possible, or must you use the getUpdated() functionality?
 
Thanks
 
 
jpizzalajpizzala
Your problem may stem from the fact that LastModifiedDate is a Timestamp and your query is missing the time portion of this. As I am not familiar with the 'between x and y' query clause (although the premise is very straightforward) I was able to recreate a query similar to yours by doing the following (adding the time element):

Code:
select id from contact where LastModifiedDate > 2007-08-02T00:00:00Z and LastModifiedDate < 2008-02-03T00:00:00Z

 Hope this helps!

Dave WallinDave Wallin
worked like a charm.  thank you.