Hi there,
I have two polygons with same value in the field Field1 (I know this value), and different values in field Field2. I need to know whether that list of polygons contains polygons with different values in field Field2. I do not need to know that values.
I try to write WHERE in ArcMap -> Select by Attributes:
(SELECT * FROM sde_table_name WHERE:) /*this is a standard row (in ArcMap) that I couldn't change*/
objectid IN (SELECT objectid FROM sde_table_name WHERE Field1=12345 group by objectid having count(distinct Field2) >1)
This returns nothing, but I definitely have 2.
Any help would be appreciated.
It is for 10.3 version and Informix database.
Hi Mark
I am not sure I understand the question but if you create a layer with field1 = 12345 and then run statistics or frequency on field2 does it gives you the results you are looking for?
Another way is to open a cursor on features that has field1 = 12345 ORDER by field2 and count the features.
Have fun
Mody
Hi Mody,
Thank you for your responce.
Just I have the concrete requirements.
Generally, the task is to check this case (a list of features contains features with same Field1 values and different Field2 values) with SQL sentence stored in a SDE table. In the table will be other SQL sentences to check other cases. The c# application should take this sentences and do some QA.
I am triyng to model this SQL sentences in ArcMap (A bit weird I agree ).
So, the question is how to accomplish the task in SQL sentence.
There is a SQL sentence that can give a result
- one row in case the Field2 is the same for all features Field1=12345.
- more than one row in case Field2 is different
(SELECT * FROM sde_table_name WHERE:) /*this is a standard row (in ArcMap) that I couldn't change*/
objectid in (SELECT MAX(objectid)
FROM sde_table_name
WHERE Field1=12345
GROUP BY Field1,Field2)
But unfortunatelly, the data type of Field2 is TEXT. That means I cannot do GROUP BY by this field.
Any workaround?
Just a thought... Maybe add a field and transfer the text in Field 2 to a numeric code... I'm sure that you thought of that by now though.
Hi Kirt,
Thank you for your answer.
I wish I were able to do it.