<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
<font size="-1"><font face="Helvetica, Arial, sans-serif">Hi,<br>
<br>
I have two tables (drug_master, cds_drugstore) with cds_master.drug_id
reference to drug_master.id.<br>
<br>
I want to fetch all the drugids, drug_name, sum of avaialble drugs (if
avaialable, or else null).<br>
<br>
I have this native MySql query, which is working fine. but I am unable
to port this in to HQL.<br>
<br>
select dm.id, dm.drug_name, sum(cds.qty_available)<br>
from drug_master dm<br>
left join cds_drugstore cds<br>
on dm.id = cds.drug_id<br>
and cds.cds_id = 1<br>
and cds.source_id = 'sourceName'<br>
and cds.source_type = 'c'<br>
group by dm.id<br>
<br>
</font></font><font size="-1"><font face="Helvetica, Arial, sans-serif">I've
didn't see any examples using 'ON' keyword. Because here I've to join
tables based on 3 tables.<br>
<br>
Some one please help. I need this very urgently. <br>
<br>
Thanks in advance.<br>
</font></font><font size="-1"><font face="Helvetica, Arial, sans-serif"><br>
<br>
Regards,<br>
ManiKanta</font></font>
</body>
</html>