Re: [sqlite] How do I combine these to 2 views ...

2017-11-26 Thread Shane Dev
So simple in hindsight, just add a second sort column 'close' to the union and then traverse the tree - thanks. On 26 November 2017 at 15:44, Clemens Ladisch wrote: > Shane Dev wrote: > > Any ideas to achieve this? > > Use another CTE to bring all rows into the correct

Re: [sqlite] How do I combine these to 2 views ...

2017-11-26 Thread Clemens Ladisch
Shane Dev wrote: > Any ideas to achieve this? Use another CTE to bring all rows into the correct order. Then a standard tree walk: WITH RECURSIVE data AS ( SELECT id, line, par, 0 AS close FROM vtag UNION ALL SELECT id, line, par, 1 FROM vparent_closetag ORDER BY id, close --

Re: [sqlite] How do I combine these to 2 views ...

2017-11-26 Thread Igor Tandetnik
On 11/26/2017 3:02 AM, Shane Dev wrote: Hello, I am try to combine the following 2 views - vtag and vparent_closetag sqlite> select id, level, line from vtag; id|lev|line id level line 1 0 2 1 3 1 4 2 5 1 6 2

Re: [sqlite] How do I combine these to 2 views ...

2017-11-26 Thread Shane Dev
Yes, the parent ID column (par) is available in both views - sqlite> select id, par, line from vtag; id par lev line 1 0 2 1 1 3 1 1 4 3 2 5 1 1 6 5 2 7 6

Re: [sqlite] How do I combine these to 2 views ...

2017-11-26 Thread Clemens Ladisch
Simon Slavin wrote: > On 26 Nov 2017, at 8:02am, Shane Dev wrote: >> Any ideas to achieve this? > > Use the UNION keyword to combine the results of the two SELECT commands That would not order the close tags correctly. >> Any ideas to achieve this? Would it be possible to

Re: [sqlite] How do I combine these to 2 views ...

2017-11-26 Thread Simon Slavin
On 26 Nov 2017, at 8:02am, Shane Dev wrote: > Any ideas to achieve this? Use the UNION keyword to combine the results of the two SELECT commands: Simon. ___ sqlite-users mailing

[sqlite] How do I combine these to 2 views ...

2017-11-26 Thread Shane Dev
Hello, I am try to combine the following 2 views - vtag and vparent_closetag sqlite> select id, level, line from vtag; id|lev|line id level line 1 0 2 1 3 1 4 2 5 1 6 2 7 3 8 2