Query two sections filtered by different custom fields, then order them Two channels:
1) exhibitions, which have a startDate and EndDate
2) events, which have a date

I need to grab the current exhibitions, future exhibitions and future events, which I do using this:

{% set allOccurrences = craft.entries.section('exhibitions').startDate('&lt;= ' ~ now | date("U")).endDate('&gt;= ' ~ now | date("U"))
    | merge(craft.entries.section('exhibitions').startDate('&gt; ' ~ now | date("U")))
    | merge(craft.entries.section('events').date('&gt;= ' ~ now | date("U"))) %}


Now what I need to do is order them, by the startDate (if an exhibition) and the date (if an event). In other words, having already fetched the entries, I need to order them by two different fields.

I'm not sure this is possible without a plugin - could anyone give me any pointers?
There's this super useful SuperSort plugin that would make this possible.

{% set sortAsTemplate = '{{ object.section == "Exhibitions" ? object.startDate|date("U") : object.date|date("U") }}' %}
{% set sortedOccurrences = allOccurrences|supersort('sortAs', sortAsTemplate) %}