# ARC/INFO Functions – Symmetrical Difference

I was recently asked by danb to illustrate the ARC/INFO function symmetrical difference. We basically want to find those areas in layer A that don’t intersect layer B, and also find those areas in layer B that don’t intersect layer A.  Its pretty easy to do, as it is created in two parts: subtracting the first layer from the second layer and then subtracting the second layer from the first layer and UNIONING them together.  I’ve added the new layers here so you can test it out.

SELECT * FROM
(
SELECT a.id AS aid, b.id AS bid, clipsubtract(a.id,b.id) AS g
FROM a, b

UNION ALL

SELECT a.id AS aid,b.id AS bid, clipsubtract(b.id,a.id) AS g
FROM a, b
)
RIGHT JOIN B ON bid = b.id
RIGHT JOIN A ON aid = a.id

## 3 thoughts on “ARC/INFO Functions – Symmetrical Difference”

1. Great. Thanks fror demonstrating this Art. I have done plenty with Manifold spatial SQL in the past but haven’t really used the UNION ALL funtion in this way. A great pointer as I can see several instances from my work where this sort of construction would be useful.
This is a really great blog BTW and a very useful resource.
Many thanks Dan

2. Hi Dr. Lembo,
the link “here” is equal to “Symmetrical Difference”.