i'm having an issues here, I'm trying to Select by attributes and using the following
(EXTRACT(YEAR FROM CURRENT_DATE) - EXTRACT(YEAR FROM "DateReported") < 10) AND "Facility" = 'Main' AND ("Cause" = 'Other' OR "DateRepaired" IS NULL)
and I'm getting the following error
Incorrect syntax near the keywrod 'FROM'
Have you tried breaking up the statement into smaller individual statements to see which section has the error?
Yes and no
It seems EXTRACT is working and CURRENT_DATE, is the issue with the DateReported field? Does this work?
Can you get it to work for a simpler expression (e.g. "EXTRACT(YEAR FROM "DateReported")=2010")?
What about moving the right-parenthesis over to before the less than comparison:
(EXTRACT(YEAR FROM CURRENT_DATE) - EXTRACT(YEAR FROM "DateReported")) < 10 AND "Facility" = 'Main' AND ("Cause" = 'Other' OR "DateRepaired" IS NULL)
Tried that and I'm getting the same error.
do the following and tell if it works
If either fails, let us know which one... build the steps incrementally and manually watching that you may need to add brackets as I have done in the above 2 examples