<!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>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; select dm.id, dm.drug_name, sum(cds.qty_available)<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; from drug_master dm<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; left join cds_drugstore cds<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; on dm.id = cds.drug_id<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; and cds.cds_id = 1<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; and cds.source_id = 'sourceName'<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; and cds.source_type = 'c'<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 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.&nbsp; 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>