Error: General ODBC Error: [Microsoft][ODBC SQL Server Driver][SQL Server]ORDER BY items must appear in the select list if SELECT DISTINCT is specified. Native error:145 when using a query that is based on another query or when merging queries

In a query, users have the ability to include the results of another query through Query Options. Users have found that when query is being used and the 'Select from query' option is enabled and populated, this error will occur. Therefore, it has been documented in Global Change & Delete, Export, Mail, Reports, Query Lists, and merging queries.  This error can also occur if you create a query from an import or report, and then add additional criteria fields to that query after. 

Download and install the latest patch, which contains all fixes from previous patches. If you are running an older version, download and install the latest version and then the patch. 

Alternative solutions:
  • Change the affected query to Static
  • Do not use the 'Select from query' option on queries. Attempt to create or merge the queries without using that Query Option. Depending on the merge scenario, using the functionality to add/remove groups of records within Query List may also work to group the desired records.
  • Do not add additional criteria to output queries
Note: Patch 2 for 7.93.5782 resolved this issue for the scenario of merging queries.


 7.93.5782, patch 4

Was this article helpful?

Thanks for your feedback! Did this solve your issue?

Comments (optional):

Thanks for your feedback!
We're glad it was helpful but sorry it didn’t solve your issue. If you need assistance, click Chat with Support below.
We’re sorry to hear that. Please tell us why.

 I don't like how this works.

 The answer is confusing.

 The answer didn't match what I was searching for.

Additional Comments (optional):

Thanks for your feedback! If you need assistance, click Chat with Support below.
Thanks for your feedback. Help us make our products even better by sharing details in our Idea Banks or our online Community.
Thanks for letting us know. We'll work on clarifying the information in the article. If you need assistance, click Chat with Support below.
Thanks for letting us know. We'll work on updating the search engine to return more relevant results.