+ Start a Discussion
TraceyTracey 

SOQL Where statement on Date

How would one write a SOQL query that queries records in the last hour? 

 

 

Select n.IsPrivate, n.Id, n.CreatedDate, n.Body From Note n

where n.CreateDate.AddDate(-1, 'h')

JimRaeJimRae

Something like this should work:

 

 

select n.IsPrivate, n.Id, n.CreatedDate, n.Body From Note n where n.CreatedDate>=:datetime.now().addhours(-1)