Definition Query help? What query expression would I use for subsetting data to Burglaries occurring in December 2016?

480
3
01-27-2018 12:45 PM
__17
by
New Contributor II

I put this expression into the Definition Query, but it says that the SQL statement is invalid: "Type" = 'BURGLARY' AND "Date" BETWEEN date '2016-12-01 00:00:00' AND date '2016-12-31 00:00:00'

What could be incorrect with this query expression?


Thanks!

0 Kudos
3 Replies
DanPatterson_Retired
MVP Emeritus

Des...Tips...

  • do the burglary query first... if it works
  • do the date query second 
    • If the date query doesn't work with between, try greater than your first date, that will check the date portion
  • if they both work, then put the subqueries in round brackets with the 'and' between

Sorry, but no date data to check with, but hopefully breaking it down will isolate your problem

__17
by
New Contributor II

Okay thanks. It finally worked! I edited the query expression. I changed it to: 

"Type" = 'BURGLARY' AND "Date" >= date '2016-12-01 00:00:00' AND "Date" <= date '2016-12-31 00:00:00'

However, I still get confused between the 'AND' and 'OR' operators. I hope I am using the correct operator for finding the burglaries occurring in December 2016.

0 Kudos
__17
by
New Contributor II

Nevermind, I checked. I did it correctly. I checked the attribute table. Thanks!

0 Kudos