Fix Bug 1035539 - Workaround for ordering within sub-queries