[hibernate-dev] Hibernate join problem
ManiKanta G
manikanta.gade at sifycorp.com
Sat Jul 5 07:45:29 EDT 2008
Hi,
I have two tables (drug_master, cds_drugstore) with cds_master.drug_id
reference to drug_master.id.
I want to fetch all the drugids, drug_name, sum of avaialble drugs (if
avaialable, or else null).
I have this native MySql query, which is working fine. but I am unable
to port this in to HQL.
select dm.id, dm.drug_name, sum(cds.qty_available)
from drug_master dm
left join cds_drugstore cds
on dm.id = cds.drug_id
and cds.cds_id = 1
and cds.source_id = 'sourceName'
and cds.source_type = 'c'
group by dm.id
I've didn't see any examples using 'ON' keyword. Because here I've to
join tables based on 3 tables.
Some one please help. I need this very urgently.
Thanks in advance.
Regards,
ManiKanta
********** DISCLAIMER **********
Information contained and transmitted by this E-MAIL is proprietary to
Sify Limited and is intended for use only by the individual or entity to
which it is addressed, and may contain information that is privileged,
confidential or exempt from disclosure under applicable law. If this is a
forwarded message, the content of this E-MAIL may not have been sent with
the authority of the Company. If you are not the intended recipient, an
agent of the intended recipient or a person responsible for delivering the
information to the named recipient, you are notified that any use,
distribution, transmission, printing, copying or dissemination of this
information in any way or in any manner is strictly prohibited. If you have
received this communication in error, please delete this mail & notify us
immediately at admin at sifycorp.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/hibernate-dev/attachments/20080705/bfe26908/attachment.html
More information about the hibernate-dev
mailing list