6

I have a table with several fields. field A contains the same kind of values as does field B. I tried to select all points where the value in field A does not exist in anywhere field B using query builder in select by attribute.

For example

ID A B
1 a b
2 b c
3 c a
4 d b

It should select the points with ID 4 since value d does not exist in field B. I think I should use a subquery, but how?

PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked Oct 29, 2015 at 13:29

2 Answers 2

5

If you use "IN" you can use a sub query that produces a list of all B values.Try:

NOT A IN (SELECT B FROM TABLE_NAME)
answered Oct 29, 2015 at 13:41
3

You should use the subquery:

FieldA not in (select FieldB from tablename)

When using the Select By Attributes tool.

ArcGIS Help page.

answered Oct 29, 2015 at 13:42
2
  • I did not know of this query before, very interesting to know! Commented Oct 29, 2015 at 13:44
  • 1
    Be careful if/when working with versioned data in ArcSDE databases. In these cases you need to ensure that the data in your subquery is a versioned view - resources.arcgis.com/EN/HELP/MAIN/10.1/index.html#//…. Otherwise, your query may return incorrect results. Commented Oct 29, 2015 at 14:31

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.