Search Query for Select Owners

08-14-2020 07:38 AM
New Contributor III

I am trying to search for the items of three owners in my ArcGIS Online organization. I can return results for one but if I try to use OR in the query, it returns items for all owners not just the ones in the OR statement. I am unsure what I am missing. It looks like the below

owner: "xxxxx@zzzzzzzzz" OR "yyyyy@zzzzz"
0 Kudos
1 Reply
MVP Regular Contributor

Hi Josh Obrecht,

In general in a query when using the OR operator in your SQL statement you will have to repeat the attribute name to make it a valid statement. If you want to specify multiple values in a WHERE clause, you can also use the IN operator. (This IN operator is actually a kind of shorthand for multiple OR conditions).

To illustrate this we will query a REST service with Dutch municipalities:

  • Query on a single municipality name: Gemeentenaam = 'Amsterdam' (look at the result)
  • Multiple values with OR - Wrong: Gemeentenaam = 'Amsterdam' OR 'Rotterdam' (this will generate an error message: 'where' parameter is invalid)
  • Multiple values with OR - Correct: Gemeentenaam = 'Amsterdam' OR Gemeentenaam = 'Rotterdam' (look at the result)
  • Multiple values with IN: Gemeentenaam IN ('Amsterdam', 'Rotterdam', 'Utrecht', 'Eindhoven') (look at the result)