How to order by a column with NULL values in it due to leftJoin?
One solution I found is based on this response:
https://stackoverflow.com/a/4326579/1214689

$query-&gt;addExpression('ffp.delta IS NULL', 'featured_delta_is_null');
$query-&gt;orderBy('featured_delta_is_null');
$query-&gt;orderBy('ffp.delta');
$query-&gt;orderBy('fp.delta');


Since sorting on the featured delta will place items with Null values at the top of the list, we need to sort featured delta in two pieces, first by those that aren't NULL (by converting to a boolean, those are lower than the ones that are NULL), then sort on the actual delta for those values that aren't null, this will leave all the other values out to be sorted by the delta on the non featured ('field_publications') field.