This documentation has no mention of sorting the elements
As an example I'll show sql query by class Sample.Employee in SAMPLES namespace, where properties Spouse and Company are relationships. You may get access to related object via ->
and you can order by alias.
SELECT
title,
Spouse->Name,
Company->Name as CompanyName
FROM
sample.employee
ORDER BY
CompanyName