Implement Recursive CTE for Hierarchical Query to MariaDB
问题 I have this table which I would like to store a chain of records. CREATE TABLE table_name ( id INT, unique_id varchar, reference_id varchar, ); I want to implement SQL query for MariDB which prints all records by unique_id with all record reference_id. Something like this: | id | unique_id | reference_id | | | |----|-----------|--------------|---|---| | 43 | 55544 | | | | | 45 | 45454 | 43 | | | | 66 | 55655 | 45 | | | | 78 | 88877 | 66 | | | | 99 | 454 | 33 | | | I would like when I select