0

I have the following SQL Recursion in mariaDB

with recursive supervisor as (
select * from staff where staff_id=6
union
select s.* from staff as s, supervisor as su
where s.staff_id=su.supervisor_id
)
select * from supervisor;

This is the execution result

enter image description here

How can i change the order into descending.

code1x1.de
  • 304
  • 2
  • 13

1 Answers1

1

Add a ROWNUM as you got through, then ORDER BY ROWNUM DESC on the outer SELECT.

Rick James
  • 135,179
  • 13
  • 127
  • 222