db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Fischer <fisc...@seitenbau.net>
Subject RE: Join with the same table
Date Fri, 10 Jun 2005 18:26:38 GMT


You have to add an alias for the table. Assuming the table is called Menu
and the relevamnt columns are ID and PARENT_ID, something like this should

criteria.addAlias("parent", MenuPeer.TABLE_NAME);
criteria.addJoin("parent.ID", MenuPeer.PARENT_ID);


"Kintzel Levente" <kintzel.levente@codespring.ro> schrieb am 10.06.2005

> Hi!
> I encoded a menu system in a database table. Each element has an ID,
> a Caption and the ParentID (the ID of the parent element in the menu
> item, it is an ID of an other record form the current table). Now I
> want to Join the table with him-self to make a list with the caption
> of the element and the caption of the parent element. Ok, that can
> be done without join, but I want to sort the lines of this list by
> the caption of the parent element. For this I think join is inevitable.
> Can anybody help me constructing this join? Thank you!
>         Regards,
>              Levy

To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org

View raw message