Skip to content

Outer ORDER BY clause has no effect [CORE2871] #3255

Closed
@firebird-automations

Description

@firebird-automations

Submitted by: @dyemanov

Is related to CORE1089
Is related to QA254

If a derived table (or a view) contains both a left/right join and an ORDER BY clause and the outer query also contains an ORDER BY clause, the latter one gets ignored.

Test query against the EMPLOYEE sample database:

select *
from (
select
emp_no, first_name, last_name, country, currency
from employee
left join country on employee.job_country = country.country
order by last_name
)
order by emp_no desc

The result is ordered by "last_name".

Commits: 3aaa3d1 98e83cd 99ccecb f815326