Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
SQL hierarchical query. branch of responses.
with recursive messages as ( select 1 as id, 1 as uid, 'a' as m, null as to_id union all select 2 as id, 1 as uid, 'b' as m, 1 as to_id union all select 3 as id, 1 as uid, 'c' as m, null as to_id union all select 4 as id, 1 as uid, 'd' as m, 1 as to_id union all select 5 as id, 1 as uid, 'e' as m, 2 as to_id union all select 6 as id, 1 as uid, 'f' as m, 1 as to_id union all select 7 as id, 1 as uid, 'g' as m, 2 as to_id ), q0 as ( select * from messages where m = 'a' ), q1(tid, msg, lvl) as ( select id, m, 0 from q0 union all select id, m, lvl + 1 from messages inner join q1 on to_id = tid ) select * from q1
run
|
edit
|
history
|
help
0
project 1
Engenheiro
Descriptor test
Laidata Practice
Assignment 1(SET A)
SQL social network practice by Han Wang 20200720 - 2
1280. Students and Examinations
fgf
filme
renaming JSON field