I am using ArcGIS Pro and have a list of APNs to Query. I did the expression:
"APN"='186250009'Or"APN"='186250013'Or"APN"=‘186250007’Or"APN"=‘186250005’Or"APN"=‘186250004Or"APN"=‘186250003Or"APN"=‘186260020’Or"APN"=‘186250002’
And it's not working.
Am I doing something wrong? Do I use "Select by Attributes" and use the SQL or do I open the Attribute table and hit "Calculate" within the Calculate Field and write the expression there.
Thank you!
What is the query for? is it a select by attribute, definition query etc?
is the APN a number or string? if it's a number get rid of the quotes.
you could also use the IN operator for efficiency:
"APN" IN (12344, 123124, 142442)
It would be to select by attribute
They Query is to select certain parcels, to illustrate just those parcels. I have about 50 of them. I am not sure which route I should go, I usually do it in the "Select Layer by Attributes" but if it's just one or I go in and select the parcels and then make a new layer out of it, but I have parcels that are not all in the same area. I hope this makes sense.
I've checked this in pro (don't use it much) and the column names have no quotation now, i'd try that
Thank you David, I will give it a try.
In ArcGIS Pro, and in ArcGIS Desktop for quite a few years, the names of file geodatabase fields can be double quoted or not. Double quotes used to be required, and although they have been phased out, they are still supported for backwards compatibility.
On the right side of my screen capture below, you'll see how I just constructed a query for parcel ids (ours are of text type to). In the select by attribute dialog, I just clicked on values; notice there are no quotes there. It took me quite a while to get used to that with ArcGIS Pro.
However, if you look at the history/details pane on the left side of the image, you'll notice the quotes around the values. It might be
Switching to the SQl view (see below) notice how the expression is written. Could it be that your syntax without spaces are giving you the problem? Notice to the lack of quotes around the field name (parcel_id)
Regarding:
And it's not working.
It helps to elaborate. What isn't working, specifically? Are you getting an error? If so, what? Are you getting unexpected results? If so, what are you expecting and what are you getting?
In terms of overall approach, I agree with David Pike in that you should use the SQL IN operator:
APN IN ('186250009', '186250013', '186250007', '186250005', '186250004', '186250003', '186260020', '186250002')
Also, in looking at your code you posted, you are using non-ASCII single quotes around some of the APN codes. For SQL queries, the single quotes need to be ASCII single quotes: CHAR(39) .
Thank you Joe, David and Joshua, It was being a pain, this is the expression that worked:
APN = '186250009' Or APN = '186250013' and etc...
I was also able to save my Expression and also check where it says "Ivert where Clause"