code1x1.de
code1x1.de

Reputation: 304

SQL Recursion desc select

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.

Upvotes: 0

Views: 82

Answers (1)

Rick James
Rick James

Reputation: 142306

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

Upvotes: 1

Related Questions