-->
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: HQL newbie - query formation/joins - 3 tables
PostPosted: Wed Jun 19, 2013 1:32 pm 
Newbie

Joined: Wed Jun 19, 2013 1:22 pm
Posts: 1
I am creating an application using Wavemaker with MySQL backend

I am trying to create a HQL where there are no FK's present between tables

Relationship as follows

OrderHeader join OrderDetail on headerID
OrderDetail join ItemMaster on itemID

I can get the first part of the query working, but not sure how to add the third part - How would i join the ItemMaster from here? The OrderDetail table has a itemID field, but I want to join the ItemMaster table to get the itemDescription (red items are fields I want add/join)

When I add the red items, I get errrors

select
order.poID as PO,
detail.lineID as line,
detail.vskuID as itemID,
items.ItemDescription

from OrderDetail as detail

LEFT JOIN OrderHeader as order where order.headID=detail.headID
JOIN ItemMaster as items where detail.itemID=items.itemID

ORDER BY order.poID,detail.lineID


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.