I try to use mthOfYr and year functions in a where clause as explained below. When I compile the query the following error message is received (Illegal use of WHERE expression). How can I use these functions in a where clause?
select sum (Value) from SalaryCalcDetails where mthOfYr(SalaryCalcDetails.CalcDate)==1
&& year(SalaryCalcDetails.CalcDate)==2012;
*This post is locked for comments
Yes I got it. Thank you
Please verify the answer if you got what you needed.
ok, thank you
You can't use X++ functions in SQL queries. Find first and last day of the month and use normal relation operators (>, <, =).
Or you could create a view with a computed column and there you can use T-SQL functions.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,134 Super User 2024 Season 2
Martin Dráb 229,928 Most Valuable Professional
nmaenpaa 101,156