You need to sign in to do that
Don't have an account?
npaustian
Token Error on SOQL WHERE CLAUSE
Hi,
I'm getting this error - can anyone help me tp understand whay this simple SELEST QUERY doesn't work?
Query in Forice.Com Explorer:
SELECT Id FROM Account WHERE DateDiff(day, CreatedDate, GETDATE()) = 0
It return the follwing error:
MALFORMED_QUERY:
FROM Account WHERE DateDiff(day, CreatedDate, GETDATE()) = 0
^
ERROR at Row:1:Column:41
unexpected token: ','
Best regards,
Nicolai
Hi,
You cannot use the DATEDIFF method in SOQL.
You can odify your query to
Date todaydate = System.today();
SELECT Id FROM Account WHERE CreatedDate =: todaydate;
This would give you all the accounts created taody, which i think is what you are trying to get.
All Answers
Hi,
You cannot use the DATEDIFF method in SOQL.
You can odify your query to
Date todaydate = System.today();
SELECT Id FROM Account WHERE CreatedDate =: todaydate;
This would give you all the accounts created taody, which i think is what you are trying to get.
you can do this too. no need of that extra variable.
List<Account> lst = [SELECT Id FROM Account WHERE CreatedDate = :system.today()];
and if you want this in Force.Com explorer... below would be perfect.
SELECT Id FROM Account WHERE CreatedDate = TODAY
TODAY here is a Date literal. See the documentation here.