Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
cte
drop table if exists layers ; create table layers ( id integer, parent integer, name text, pubstate text, wms text ); insert into layers values (1,null,'Root','published',null), (10,1,'VOB','published',null), (11,1,'VXY','published',null), (200,10,'VOB32-Picture1','published','WRK:PIC82810'), (201,10,'VOB32-Picture2','published','WRK:PIC31993'), (203,10,'VOB42-PictureNearWell','published','WRK:PIC11233'), (204,10,'VOB43-PictureNearWell','draft','WRK:PIC32343'); with recursive mytree as ( select id,parent,name,pubstate, wms, 1 as level, cast(l.id as text) as breadcrumb from layers l where parent is null union all select c.id,c.parent,c.name,c.pubstate, c.wms, p.level + 1, p.breadcrumb || '-' || cast(c.id as text) as breadcrumb from layers c join mytree p on p.id = c.parent ) select * from mytree order by breadcrumb asc
run
|
edit
|
history
|
help
0
extract_pairs
UNIX_TIMESTAMP
podd version
xD
distinct on vs row_number
Mandelbrot
Cross Tab With Totals
Conditional Cross Join - Why doesn't this work on the 'ON' clause?
Select rows only with values separated by a given interval from other ...
IF IN POSTGRESQL