Sadly the wiki documentation does not appear to be available for this topic :-(
-----Original Message-----
From: Brice Ruth [mailto:[EMAIL PROTECTED]
Sent: 06 April 2005 18:20
To: ibatis-user-java@incubator.apache.org
Subject: Re: building a hierarchy

Check the Wiki for the 1:N and M:N N+1 selects stuff ... I think that's what you're looking for.

On Apr 6, 2005 11:16 AM, Steven Pannell <[EMAIL PROTECTED]> wrote:
Hi,

Does anyone know how I could (if possible) build a hierarchy of objects
using a single SQL statement.  Is this possible?

For example I have a SQL table of BOXES.  A BOX can contain other BOXES and
so on, like:

class BOX {
       public void id();
       public void parentBoxId();
       public BOX getChild();
}

my sql would be something like:

select * from boxes b1, boxes b2
where b1.id = b2.parentBoxId;

result is a big list of boxes but I want the parent / child hierarchy.

anyway to do this?  know what I mean?

thx.
Steve.




--
Brice Ruth
Software Engineer, Madison WI

Reply via email to