You need to sign in to do that
Don't have an account?
Comparing dates in SOQL WHERE clause
I want to do the following query to find unread EmailMessage records related either to (1) open cases or (2) related to cases that were already closed when the EmailMessage record was created.
I would think it would be:
select id,ParentId, Parent.Owner.Name,Parent.IsClosed, Parent.ClosedDate,status,fromaddress,toaddress,messagedate,subject from emailMessage where status ='0' and (Parent.IsClosed = false or emailMessage.CreatedDate > Parent.ClosedDate)
I get "unexpected token: 'Parent.ClosedDate'"
Can I not compare one date to another using "greater-than"?
If I replace either Parent.ClosedDate or emailMessage.CreatedDate with something like LAST_WEEK then the query works but not comparing to each other.
Any help is appreciated!!
Thanks for the answer!! Though honestly, I don't know whether to cry or laugh.