Re: SQL to get WORKING from NODES

2010-09-24 Thread Greg Stein
On Fri, Sep 24, 2010 at 10:26, Philip Martin wrote: > Greg Stein writes: > >> Step back and look at that code. >> >> The gather_children() got a bit more complicated because I was trying >> to get the list of children from BASE_NODE and WORKING_NODE, and union >> those together (or skip the union

Re: SQL to get WORKING from NODES

2010-09-24 Thread Philip Martin
Greg Stein writes: > Step back and look at that code. > > The gather_children() got a bit more complicated because I was trying > to get the list of children from BASE_NODE and WORKING_NODE, and union > those together (or skip the union altogether in certain cases). With > NODES, it becomes one s

Re: SQL to get WORKING from NODES

2010-09-24 Thread Greg Stein
On Fri, Sep 24, 2010 at 07:05, Philip Martin wrote: > Philip Martin writes: > >> but I don't know how to fix the second one.  How do I count the number >> of rows returned by that GROUP BY query? > > From IRC the following was suggested > > -- STMT_SELECT_WORKING_NODE_CHILDREN_1 > SELECT DISTINCT

Re: SQL to get WORKING from NODES

2010-09-24 Thread Philip Martin
Philip Martin writes: >> This leads on to the problem of selecting just the highest op_depth >> for each child. Is it possible to get one query to return just the >> highest op_depth for each child? > > I suspect we will still want to do this at some point. This was suggested: SELECT * FROM no

Re: SQL to get WORKING from NODES

2010-09-24 Thread Philip Martin
Philip Martin writes: > but I don't know how to fix the second one. How do I count the number > of rows returned by that GROUP BY query? >From IRC the following was suggested -- STMT_SELECT_WORKING_NODE_CHILDREN_1 SELECT DISTINCT local_relpath FROM nodes WHERE wc_id = ?1 AND parent_relpath = ?