Different results using sql and st_geometry functions

Discussion created by ufeliciano on Jan 23, 2014
Latest reply on Jan 23, 2014 by mboeringa2010
I wanted to know how many features from my parcel layer intersect the required municipality.  The parcel feature class is versioned and there are are several versions created in our database.  Using sql I wrote the following statement...

SELECT count(*)
FROM parcels p,municipios m
WHERE sde.st_intersects (p.shape,m.shape) = 1
AND m.municipios='desired_one'
order by p.pin;

this returns 7434 records.  Using select by location in ArcMap, the application returned 7436 selected features.  Both queries were done relatively at the same time.  I ran "exec sde.version_util.set_current_version('SDE.DEFAULT');" just in case in my latest tries, but still the same results.  What can explain the difference between this approaches?  Is it an expected behaviour?  Any ideas or suggestions on how to obtain the same results?