Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.databases.postgresql > #823
| Newsgroups | comp.databases.postgresql |
|---|---|
| Date | 2018-04-19 14:45 -0700 |
| References | <f1e640c3-d6a7-4a19-af0e-1a7dfa54d65d@googlegroups.com> <m2lgdl34h7.fsf@tapoueh.org> |
| Message-ID | <3d6183b3-6fbf-442f-90bf-d2530eb6cc2d@googlegroups.com> (permalink) |
| Subject | Re: Postgres 9.6 - ltree extension - (re)build a tree on a table |
| From | lordluke80@gmail.com |
Il giorno martedì 17 aprile 2018 23:31:01 UTC+2, Dimitri Fontaine ha scritto: > lordluke80@gmail.com writes: > > Any suggestion to achieve that or snippets about how to do that? havent foud any valid example for 'rebuild a tree in postgres' in the official docs. > > Have a look at WITH RECURSIVE: > > https://www.postgresql.org/docs/current/static/queries-with.html > https://tapoueh.org/blog/2018/01/exporting-a-hierarchy-in-json-with-recursive-queries/ > > Regards, > -- > Dimitri Fontaine Thanks Dimitri (and congrats for the book!) I modified the table and this solution came up: http://dpaste.com/2QXFP0M What I'm trying to do is fetchig for each id the one with max level. However, I'm messing up something since despite using DISTINCT there are still duplicated rows. Any hints about that? Thanks
Back to comp.databases.postgresql | Previous | Next — Previous in thread | Find similar
Postgres 9.6 - ltree extension - (re)build a tree on a table lordluke80@gmail.com - 2018-04-17 01:44 -0700
Re: Postgres 9.6 - ltree extension - (re)build a tree on a table Dimitri Fontaine <dim@tapoueh.org> - 2018-04-17 23:31 +0200
Re: Postgres 9.6 - ltree extension - (re)build a tree on a table lordluke80@gmail.com - 2018-04-19 14:45 -0700
csiph-web