[odb-users] MySQL 5.7 ORDER BY clause is not in SELECT list
boris at codesynthesis.com
Wed Nov 8 09:04:34 EST 2017
Lukas Obermann <obermann.lukas at gmail.com> writes:
> I have a big view which joins in a lot of tables and just return the id
> of the „main“ table. But, I need to order the response based on different
> values which are joined in. So I just append „ORDER BY „+column to the
> Now, since MySQL 5.7 there was a constraint added that the field used in
> the order by must be present in the select list.
Uh, that's quite user-unfriendly of them.
> Is there a way to work around this without having to modify the mysql
> mode on the server?
You mean you can change the MySQL configuration to allow this? If so,
this is the best solution, IMO.
> So to either dynamically add the field to the select list or is there
> a special call to use for ordering?
No, there is nothing like this. And it is unlikely we will be trying to
work around this in ODB in the future. This is just MySQL brain-death.
> Of course I do not want to add all the fields to the select list as
> it would take forever to query then.
The only other option is to create a separate view for each column that
you want to order by.
More information about the odb-users