I'm not a db expert, but I know torque OM objects that relate to themselves can work like this:
(example from my own project)


  <table name="Exercise" idMethod="idbroker">
    <column name="ExerciseID" required="true" primaryKey="true"
type="INTEGER"/>
        <column name="Name" required="true" size="80" type="VARCHAR" />
        <column name="Description"  type="LONGVARCHAR" />
        <column name="InstructionsID" type="INTEGER" />
        <column name="ParentExerciseID" type="INTEGER" />
        <column name="Expired" type="TIMESTAMP" />
        <column name="EntryDeleted" type="TIMESTAMP" />
        <column name="Tag" size="80" type="VARCHAR" />
        <column name="CourseID" type="INTEGER" />
        <column name="DateCreated" type="TIMESTAMP" />        
        
    <unique><unique-column name="ExerciseID"/></unique>

    <foreign-key foreignTable="Exercise">
      <reference local="ParentExerciseID" foreign="ParentExerciseID"/>
    </foreign-key>
        
    <foreign-key foreignTable="Instructions">
      <reference local="InstructionsID" foreign="InstructionsID"/>
    </foreign-key>
        
    <foreign-key foreignTable="Course">
      <reference local="CourseID" foreign="CourseID"/>
    </foreign-key>
        
  </table>

To see documentation for the resulting OM class, check here:
http://www.kjsdesigns.com/javadoc/ca/utoronto/utm/datasphere/om/BaseExercise.
html


So then, all you have to do to get the ParentID object is run the: Exercise getExerciseRelatedByParentexerciseid() method.

I'm not sure if this is what you're wanting - if not, please clarify and someone else will help

Cheers
Keith

On Tuesday, July 22, 2003, at 09:05 AM, Chris Rafuse wrote:

Hello,

Can anyone tell me if you can join a table with itself using torque? And
if so, maybe a little example? I need to join a table with itself
several times.

Thanks,


Chris



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



___________________________________
Keith Seim • http://kjsdesigns.com


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to