Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
SQL hierarchical query. branch of responses.
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
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
absolute service time: 0,43 sec
edit mode
|
history
|
discussion
tid
msg
lvl
1
1
a
0
2
6
f
1
3
4
d
1
4
2
b
1
5
7
g
2
6
5
e
2