Make sure buildSortingSelectSQL() does not crash (#2721)
Make sure buildSortingSelectSQL() does not crash (#2721)

The default implementation of `buildSortingSelectSQL()` is well suited
for Fields that do not provide a custom `buildSortingSQL()`
implementation. But this can make Fields with a custom `buildSortingSQL()`
implementation without a `buildSortingSelectSQL()` crash if they do not
have the 'value' column.

This commits adds a check to find if the thing we want to add in the select
exists in the sort expression.

Fixes #2718

Picked from b203f7e
Picked from 3e33aef

bauhouse/sym-todo-list,michael-e/symphony-2,symphonycms/symphony-2,jensscherbl/symphony,jensscherbl/symphony,bauhouse/sym-todo-list,symphonycms/symphony-2,michael-e/symphony-2