Skip to content

Instantly share code, notes, and snippets.

@kura1420
Created August 21, 2018 18:28
Show Gist options
  • Select an option

  • Save kura1420/d0acd9c6077e051333940e9f8bb9094b to your computer and use it in GitHub Desktop.

Select an option

Save kura1420/d0acd9c6077e051333940e9f8bb9094b to your computer and use it in GitHub Desktop.
MariaDB Recursive
SELECT member_id
FROM
(SELECT * FROM member ORDER BY member_parent, member_id ASC) as a,
(SELECT @pv := 2) initialisation
WHERE find_in_set(member_parent, @pv) > 0 AND @pv := CONCAT(@pv, ',', member_id)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment