Referring to the SQL you posted, you can place that into a Django extra()
Queryset modifier:
qs = YourModel.objects.extra(select={
'max_time': '''
select * from t where (
start_time_a in (
select greatest(max(start_time_a), max(start_time_b)) from t
) or start_time_b in (
select greatest(max(start_time_a), max(start_time_b)) from t
)
)'''
})
# each YourModel object in the queryset will have an extra attribute, max_time
for obj in qs:
print obj.max_time