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
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