erick.wiggs

Duplicate Query within Multiple Attributes

Discussion created by erick.wiggs on Aug 18, 2016

I’ve got a SQL query problem I was hoping someone might have a solution for.

 

I’m querying my table (COM_GDB.GISADMIN.COM_CRM_MasterFeatureClass) for duplicate X and Y coordinates. The coordinates reside in different attribute columns named X and Y respectively (i know it's original). To accomplish this query I am currently using the statement supplied by the tech article How To: Query for duplicate records in a feature class table :

 

X In (SELECT X FROM COM_GDB.GISADMIN.COM_CRM_MasterFeatureClass GROUP BY X HAVING Count(*)>1 ) AND

Y In (SELECT Y FROM COM_GDB.GISADMIN.COM_CRM_MasterFeatureClass GROUP BY Y HAVING Count(*)>1 )

This works very well when querying one attribute column, but I am noticing that it fails when combining the two statements using AND. Is this because it looks for duplicates in X AND then duplicates in Y? And not for only duplicate combinations of X and Y?

 

 

It was suggested that I group X and Y together using this statement:

 

X,Y in (SELECT X,Y FROM COM_GDB.GISADMIN.COM_CRM_MasterFeatureClass GROUP BY X,Y HAVING Count(*)>1 )

but I'm getting the error of "An expression of non-boolean type specified in context where a condition is expected, near ",". The same occurs when I group X and Y as 'X,Y', and I assume this is because X and Y are both Field Type: Double?

 

Help??

Outcomes