Re: [sqlite] graph question

2008-06-09 Thread David Baird
On Mon, Jun 9, 2008 at 3:49 PM, Bruce Robertson <[EMAIL PROTECTED]> wrote: >> select f || ' ' || group_concat(t, ' ') >> from w >> where f in (1, 2, 3); >> group by f; >> >> HTH >> Dennis > > Can you explain that? > > What's the || ' ' || part? || is the string concat operator. e.g.

Re: [sqlite] graph question

2008-06-09 Thread Bruce Robertson
> David Baird wrote: >> >> Okay, just built SQLite 3.5.9 and group_concat does in fact work: >> >> select group_concat(t, ' ') from w where f=1; > > You forgot the parent value at the beginning. Also, the OP may want to > do this for several parents which can be accomplished by grouping the

Re: [sqlite] graph question

2008-06-09 Thread Wilson, Ron P
M To: General Discussion of SQLite Database Subject: Re: [sqlite] graph question Wicked. Thanks David and Dennis! And this works like a charm for all parents: select f || ' ' || group_concat(t, ' ') from w group by f; This pushes me up to a '2' on the SQL Guru Meter. RW SQLGuru-O-Meter |0-+--510|

Re: [sqlite] graph question

2008-06-09 Thread David Baird
On Mon, Jun 9, 2008 at 11:40 AM, Dennis Cote <[EMAIL PROTECTED]> wrote: > David Baird wrote: >> >> Okay, just built SQLite 3.5.9 and group_concat does in fact work: >> >> select group_concat(t, ' ') from w where f=1; > > You forgot the parent value at the beginning. Also, the OP may want to >

Re: [sqlite] graph question

2008-06-09 Thread Wilson, Ron P
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dennis Cote Sent: Monday, June 09, 2008 1:41 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] graph question David Baird wrote: > > Okay, just built SQLite 3.5.9 and group_conca

Re: [sqlite] graph question

2008-06-09 Thread Wilson, Ron P
, June 09, 2008 1:09 PM To: sqlite-users@sqlite.org Subject: Re: [sqlite] graph question Wilson, Ron P <[EMAIL PROTECTED]> wrote: > select t from w where f=1; > 2 > 3 > 4 > 5 > 6 > 7 > > I would like the output to look like this: > > 1 2 3 4 5 6 7 > &

Re: [sqlite] graph question

2008-06-09 Thread Dennis Cote
David Baird wrote: > > Okay, just built SQLite 3.5.9 and group_concat does in fact work: > > select group_concat(t, ' ') from w where f=1; You forgot the parent value at the beginning. Also, the OP may want to do this for several parents which can be accomplished by grouping the results.

Re: [sqlite] graph question

2008-06-09 Thread David Baird
On Mon, Jun 9, 2008 at 11:19 AM, David Baird <[EMAIL PROTECTED]> wrote: > On Mon, Jun 9, 2008 at 11:09 AM, Igor Tandetnik <[EMAIL PROTECTED]> wrote: >> Wilson, Ron P >> <[EMAIL PROTECTED]> >> wrote: >>> select t from w where f=1; >>> 2 >>> 3 >>> 4 >>> 5 >>> 6 >>> 7 >>> >>> I would like the output

Re: [sqlite] graph question

2008-06-09 Thread David Baird
On Mon, Jun 9, 2008 at 11:09 AM, Igor Tandetnik <[EMAIL PROTECTED]> wrote: > Wilson, Ron P > <[EMAIL PROTECTED]> > wrote: >> select t from w where f=1; >> 2 >> 3 >> 4 >> 5 >> 6 >> 7 >> >> I would like the output to look like this: >> >> 1 2 3 4 5 6 7 >> >> i.e. parent child1 child2 ... childN > >

Re: [sqlite] graph question

2008-06-09 Thread Igor Tandetnik
Wilson, Ron P <[EMAIL PROTECTED]> wrote: > select t from w where f=1; > 2 > 3 > 4 > 5 > 6 > 7 > > I would like the output to look like this: > > 1 2 3 4 5 6 7 > > i.e. parent child1 child2 ... childN SQL is not formatting or reporting library. It gives you raw data, and it's up to your

[sqlite] graph question

2008-06-09 Thread Wilson, Ron P
Given the following: create table w (f, t); begin; insert into w (f, t) values (1, 2); insert into w (f, t) values (1, 3); insert into w (f, t) values (1, 4); insert into w (f, t) values (1, 5); insert into w (f, t) values (1, 6); insert into w (f, t) values (1, 7); ... commit; select t from w