Created
July 31, 2019 09:52
-
-
Save AnishLushte07/981d4d9229afc482602e62efae7ac97a to your computer and use it in GitHub Desktop.
Tree selection sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select id, | |
name, | |
parent_id | |
from (select * from user_categories | |
order by parent_id, id) products_sorted, | |
(select @pv := '104') initialisation | |
where find_in_set(parent_id, @pv) | |
and length(@pv := concat(@pv, ',', id)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment