Order entries by DATEDIFF I'm trying to order the results of an entries query by the difference between two date fields but I can't seem to get it to work.
Here is my query:
{% set todaysStreamsParams = {
  section : 'films',
  orderBy : &quot;DATEDIFF(`screeningDateFirst`, `screeningDateLast`) DESC&quot;,
  limit   : 5,
} %}

{% set todaysStreams = craft.entries(todaysStreamsParams).all() %}

But I'm getting the following database exception:
Unknown column 'screeningDateFirst' in 'order clause.

Any tips?
Digging around a bit, it looks like more complex order queries need to be fully elaborated. I adjusted as follows for it to work:
orderBy : &quot;DATEDIFF(`content`.`field_screeningDateFirst`, `content`.`field_screeningDateLast`) DESC&quot;,