Not all rows are returned when generating a layer or table based on a Query

Last Published: April 25, 2020


There are fewer rows in the table created from a query than expected. More rows are returned when executing the same query on my database.


The ArcObjects components that store the query also take a primary key column name which is used to generate ObjectId's. If this column is not unique, only 1 row is returned per unique value. For example, if a table has 10 rows but only 7 unique values in the unique column, only 7 rows are returned.

Solution or Workaround

  • Use another column as the primary key which truly has unique values.
  • Do not set a primary key. This may result in slower performance, but the results will be as expected.

Article ID:000005733

  • ArcMap 9 x
  • ArcMap 8 x

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Discover more on this topic