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


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.