Philip Martin <philip.mar...@wandisco.com> 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 nodes as n
 WHERE wc_id = ?1
   AND parent_relpath = ?2
   AND op_depth = (SELECT MAX(op_depth) FROM nodes as m
                    WHERE m.wc_id = n.wc_id
                      AND m.local_relpath = n.local_relpath
                      AND m.op_depth > 0);

which I think does what I want.

-- 
Philip

Reply via email to