FM2-626: Follow-up: Fix SELECT DISTINCT queries in non-MySQL contexts
For search queries on a small subset of tables, we need to use two queries
to generate the search results, one to get the list of ids and one to get
the "full" corresponding domain object.
In FM2-626, we optimized this a bit by pushing the ordering of results
into the initial query instead of the secondary query, but doing so
meant we now generated queries that were incorrect except on MySQL.
This commit reverts the MySQL-only nature of the queries we were generating