Error: A selection can only be created for a query containing an aggregate when the query's primary key field is included in the output.

When attempting to save a selection for a query, the below message appears:

"A selection can only be created for a query containing an aggregate when the query's primary key field is included in the output."

For example, you are under Analysis > Query and have added a new query. On the Set Save Options tab you have checked the box, "Save a selection" and then the error occurs after clicking "Save."
To resolve the issue, add the "Primary key" field to the output of the query results. First open your query to edit, then follow the below steps to add the Primary keys to your results:

Constituent Query
  1. In the left column, select Constituents. From the middle column, drag Constituent record into Results fields to display.
  2. On the Set Save Options tab, attempt to save the query and Create a selection again

Revenue Query
  1. In the left column, select Revenue. From the middle column, drag Revenue record into Results fields to display
  2. On the Set Save Options tab, attempt to save the query and Create a selection again

Sales Orders Query
  1. In the left column, select Sales Orders. From the middle column, drag Sales order record into Results fields to display.
  2. On the Set Save Options tab, attempt to save the query and Create a selection again

Registrants Query
  1. In the left column, select Registrants. From the middle column underneath System Fields, drag System record ID into Results fields to display.
  2. On the Set save options tab, attempt to save the query and Create a selection again

Reservation Query
  1. In the left column, select Group Sales Reservations. From the middle column in the Reservation Record group, drag Reservation Record into Results fields to display.
  2. On the Set save options tab, attempt to save the query and Create a selection again.

Environment

 2.92

Was this article helpful?