-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: join on the same table twice in a query
PostPosted: Mon Apr 14, 2008 2:24 pm 
Newbie

Joined: Wed Feb 06, 2008 3:43 pm
Posts: 5
Hi,

I'm wondering if there is way to join on the same table twice in a query ?

SELECT t1, t2, t3, t4, t5, t6, t7, t8
FROM
TbCollection AS t1,
TbObject AS t2
LEFT outer JOIN t2.stringValues as t3 with t3.AttributesId = 1
LEFT outer JOIN t2.stringValues as t4 with t4.AttributesId = 2
LEFT outer JOIN t2.dateValues as t5 with t5.AttributesId = 3
LEFT outer JOIN t2.stringValues as t6 with t6.AttributesId = 4
LEFT outer JOIN t2.stringValues as t7 with t7.AttributesId = 5
LEFT outer JOIN t2.stringValues as t8 with t8.AttributesId= 6
where t1.CollectionId = t2.CollectionId AND t1.DomaineCode = 123

<bag name="stringValues" table="tb_attributes_string" lazy="false">
<key column="OBJECT_ID" />
<one-to-many class="persistance.TbAttributesString" />
</bag>

Because i'm having a problem, elements from the same table have the same instance.

regards


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.