If you are using the a current version of SQLite you can use a (ANSI standard compliant) recursive query:
with recursive group_tree as (
select id_group,
id_parent,
sequence
from groups
where id_parent = 0 -- marks the start of your tree
union all
select c.id_group,
c.id_parent,
c.sequence
from groups p
join group_tree c on p.id_group = c.id_parent
)
select *
from group_tree;
If you want to start anywhere else in the hierarchy, just replace the where id_parent = 0
with e.g. where id_group = 10
to get all children of that group.
More details in the manual: https://www.sqlite.org/lang_with.html