Dear all, I am developing a web application for a biological research institute down here in india. I have some <br>problem in using JOINS. The below is the queries i used,<br><br><b>SQL query<br><br></b><b>File name : <span style="color: rgb(0, 102, 0);">drug</span></b><br>
<span style="color: rgb(255, 102, 102);">select drug_name,dtype from bio_info_schema.drug order by dtype</span><br><br><b>File name:<span style="color: rgb(0, 102, 0);">drug_gene_details</span></b><br>Note : i used both the sql queries seperately, but neither one worked.<br>
<br><span style="font-family: courier new,monospace; color: rgb(255, 102, 102);">SELECT drug.drug_name,drug.route_of_admin,drug.dose_adult,drug.dose_child,drug.adverse_effects,drug_gene.gene_name </span><br style="font-family: courier new,monospace; color: rgb(255, 102, 102);">
<span style="font-family: courier new,monospace; color: rgb(255, 102, 102);">FROM drug,drug_gene </span><br style="font-family: courier new,monospace; color: rgb(255, 102, 102);"><span style="font-family: courier new,monospace; color: rgb(255, 102, 102);">WHERE drug.drug_name = drug_gene.drug_name and drug.drug_name=&lt;dtml-sqlvar drug_name type=string&gt;</span><br style="font-family: courier new,monospace; color: rgb(255, 102, 102);">
<br style="font-family: courier new,monospace; color: rgb(255, 102, 102);"><span style="font-family: courier new,monospace; color: rgb(255, 102, 102);">SELECT drug.drug_name,drug.route_of_admin,drug.dose_adult,drug.dose_child,drug.adverse_effects,drug.dtype,drug_gene.gene_name</span><br style="font-family: courier new,monospace; color: rgb(255, 102, 102);">
<span style="font-family: courier new,monospace; color: rgb(255, 102, 102);">FROM drug INNER JOIN drug_gene </span><br style="font-family: courier new,monospace; color: rgb(255, 102, 102);"><span style="font-family: courier new,monospace; color: rgb(255, 102, 102);">ON drug.drug_name = drug_gene.drug_name AND drug.drug_name=&lt;dtml-sqlvar drug_name type=string&gt;</span><br>
<br>Below is the DTML code i have used,<br><br><b>File name : <span style="color: rgb(0, 102, 0);">view_drug_detail</span></b><br><span style="font-family: courier new,monospace; background-color: rgb(255, 255, 255); color: rgb(255, 0, 0);">&lt;table width = 30% border = 1 &gt;</span><br style="font-family: courier new,monospace; background-color: rgb(255, 255, 255); color: rgb(255, 0, 0);">
<span style="font-family: courier new,monospace; background-color: rgb(255, 255, 255); color: rgb(255, 0, 0);">&lt;tr&gt;</span><br style="font-family: courier new,monospace; background-color: rgb(255, 255, 255); color: rgb(255, 0, 0);">
<span style="font-family: courier new,monospace; background-color: rgb(255, 255, 255); color: rgb(255, 0, 0);">&lt;!-- Table header --&gt;</span><br style="font-family: courier new,monospace; background-color: rgb(255, 255, 255); color: rgb(255, 0, 0);">
<span style="font-family: courier new,monospace; background-color: rgb(255, 255, 255); color: rgb(255, 0, 0);">&lt;th&gt;Drug Name&lt;/th&gt;</span><br style="font-family: courier new,monospace; background-color: rgb(255, 255, 255); color: rgb(255, 0, 0);">
<span style="font-family: courier new,monospace; background-color: rgb(255, 255, 255); color: rgb(255, 0, 0);">&lt;/tr&gt;</span><br style="font-family: courier new,monospace; background-color: rgb(255, 255, 255); color: rgb(255, 0, 0);">
<span style="font-family: courier new,monospace; background-color: rgb(255, 255, 255); color: rgb(255, 0, 0);">&lt;!-- Iterate through drug details using dtml-in tag --&gt;</span><br style="font-family: courier new,monospace; background-color: rgb(255, 255, 255); color: rgb(255, 0, 0);">
<span style="font-family: courier new,monospace; background-color: rgb(255, 255, 255); color: rgb(255, 0, 0);">&lt;dtml-in drug&gt;</span><br style="font-family: courier new,monospace; background-color: rgb(255, 255, 255); color: rgb(255, 0, 0);">
<span style="font-family: courier new,monospace; background-color: rgb(255, 255, 255); color: rgb(255, 0, 0);">&lt;!-- for each drug , print out the drug name and type of drug --&gt;</span><br style="font-family: courier new,monospace; background-color: rgb(255, 255, 255); color: rgb(255, 0, 0);">
<span style="font-family: courier new,monospace; background-color: rgb(255, 255, 255); color: rgb(255, 0, 0);">&lt;tr&gt;</span><br style="font-family: courier new,monospace; background-color: rgb(255, 255, 255); color: rgb(255, 0, 0);">
<span style="font-family: courier new,monospace; background-color: rgb(255, 255, 255); color: rgb(255, 0, 0);">&lt;td align = center&gt;</span><br style="font-family: courier new,monospace; background-color: rgb(255, 255, 255); color: rgb(255, 0, 0);">
<span style="font-family: courier new,monospace; background-color: rgb(255, 255, 255); color: rgb(255, 0, 0);">&lt;a href=&quot;<a href="http://localhost:8080/ddrd/ddrtb/drugs/display_drugs/">http://localhost:8080/ddrd/ddrtb/drugs/display_drugs/</a><b><span style="color: rgb(0, 102, 0);">drug_gene_details</span></b>/drug_name/&lt;dtml-var drug_name&gt;/<b><span style="color: rgb(0, 102, 0);">view_drug_info</span></b>&quot;&gt;&lt;dtml-var drug_name&gt;&lt;/a&gt;&lt;/td&gt;</span><br style="font-family: courier new,monospace; background-color: rgb(255, 255, 255); color: rgb(255, 0, 0);">
<span style="font-family: courier new,monospace; background-color: rgb(255, 255, 255); color: rgb(255, 0, 0);">&lt;/tr&gt;</span><br style="font-family: courier new,monospace; background-color: rgb(255, 255, 255); color: rgb(255, 0, 0);">
<span style="font-family: courier new,monospace; background-color: rgb(255, 255, 255); color: rgb(255, 0, 0);">&lt;/dtml-in&gt;</span><br style="font-family: courier new,monospace; background-color: rgb(255, 255, 255); color: rgb(255, 0, 0);">
<span style="font-family: courier new,monospace; background-color: rgb(255, 255, 255); color: rgb(255, 0, 0);">&lt;/table&gt;<br><br></span><b>File name : <span style="color: rgb(0, 102, 0);">view_drug_info</span></b><br>
<span style="color: rgb(255, 102, 102); font-family: courier new,monospace;">&lt;h3&gt;&lt;font color= #008000&gt;&lt;center&gt;Drug Information Summary&lt;/center&gt;&lt;/font&gt;&lt;/h3&gt;</span><br style="color: rgb(255, 102, 102); font-family: courier new,monospace;">
<span style="color: rgb(255, 102, 102); font-family: courier new,monospace;">&lt;table width = 100% border = 1 align=center&gt;</span><br style="color: rgb(255, 102, 102); font-family: courier new,monospace;"><span style="color: rgb(255, 102, 102); font-family: courier new,monospace;">&lt;tr&gt;</span><br style="color: rgb(255, 102, 102); font-family: courier new,monospace;">
<span style="color: rgb(255, 102, 102); font-family: courier new,monospace;">&lt;th&gt;Drug name&lt;/th&gt;&lt;td&gt;&lt;dtml-var drug_name&gt;&lt;/td&gt;</span><br style="color: rgb(255, 102, 102); font-family: courier new,monospace;">
<span style="color: rgb(255, 102, 102); font-family: courier new,monospace;">&lt;/tr&gt;</span><br style="color: rgb(255, 102, 102); font-family: courier new,monospace;"><span style="color: rgb(255, 102, 102); font-family: courier new,monospace;">&lt;tr&gt;</span><br style="color: rgb(255, 102, 102); font-family: courier new,monospace;">
<span style="color: rgb(255, 102, 102); font-family: courier new,monospace;">&lt;th&gt;Route of Administration&lt;/th&gt;&lt;td&gt;&lt;dtml-var route_of_admin&gt;&lt;/td&gt;</span><br style="color: rgb(255, 102, 102); font-family: courier new,monospace;">
<span style="color: rgb(255, 102, 102); font-family: courier new,monospace;">&lt;/tr&gt;</span><br style="color: rgb(255, 102, 102); font-family: courier new,monospace;"><span style="color: rgb(255, 102, 102); font-family: courier new,monospace;">&lt;tr&gt;</span><br style="color: rgb(255, 102, 102); font-family: courier new,monospace;">
<span style="color: rgb(255, 102, 102); font-family: courier new,monospace;">&lt;th&gt;Dosage (Adult)&lt;/th&gt;&lt;td&gt;&lt;dtml-var dose_adult&gt;&lt;/td&gt;</span><br style="color: rgb(255, 102, 102); font-family: courier new,monospace;">
<span style="color: rgb(255, 102, 102); font-family: courier new,monospace;">&lt;/tr&gt;</span><br style="color: rgb(255, 102, 102); font-family: courier new,monospace;"><span style="color: rgb(255, 102, 102); font-family: courier new,monospace;">&lt;tr&gt;</span><br style="color: rgb(255, 102, 102); font-family: courier new,monospace;">
<span style="color: rgb(255, 102, 102); font-family: courier new,monospace;">&lt;th&gt;Dosage (Child)&lt;/th&gt;&lt;td&gt;&lt;dtml-var dose_child&gt;&lt;/td&gt;</span><br style="color: rgb(255, 102, 102); font-family: courier new,monospace;">
<span style="color: rgb(255, 102, 102); font-family: courier new,monospace;">&lt;/tr&gt;</span><br style="color: rgb(255, 102, 102); font-family: courier new,monospace;"><span style="color: rgb(255, 102, 102); font-family: courier new,monospace;">&lt;tr&gt;</span><br style="color: rgb(255, 102, 102); font-family: courier new,monospace;">
<span style="color: rgb(255, 102, 102); font-family: courier new,monospace;">&lt;th&gt;Adverse Effects&lt;/th&gt;&lt;td&gt;&lt;dtml-var adverse_effects&gt;&lt;/td&gt;</span><br style="color: rgb(255, 102, 102); font-family: courier new,monospace;">
<span style="color: rgb(255, 102, 102); font-family: courier new,monospace;">&lt;/tr&gt;</span><br style="color: rgb(255, 102, 102); font-family: courier new,monospace;"><span style="color: rgb(255, 102, 102); font-family: courier new,monospace;">&lt;tr&gt;</span><br style="color: rgb(255, 102, 102); font-family: courier new,monospace;">
<span style="color: rgb(255, 102, 102); font-family: courier new,monospace;">&lt;th&gt;Drug Type&lt;/th&gt;&lt;td&gt;&lt;dtml-var dtype&gt;&lt;/td&gt;</span><br style="color: rgb(255, 102, 102); font-family: courier new,monospace;">
<span style="color: rgb(255, 102, 102); font-family: courier new,monospace;">&lt;/tr&gt;</span><br style="color: rgb(255, 102, 102); font-family: courier new,monospace;"><span style="color: rgb(255, 102, 102); font-family: courier new,monospace;">&lt;tr&gt;</span><br style="color: rgb(255, 102, 102); font-family: courier new,monospace;">
<span style="color: rgb(255, 102, 102); font-family: courier new,monospace;">&lt;th&gt;Drug Targets&lt;/th&gt;&lt;td&gt;&lt;dtml-var gene_name&gt;&lt;/td&gt;</span><br style="color: rgb(255, 102, 102); font-family: courier new,monospace;">
<span style="color: rgb(255, 102, 102); font-family: courier new,monospace;">&lt;/tr&gt;</span><br style="color: rgb(255, 102, 102); font-family: courier new,monospace;"><span style="color: rgb(255, 102, 102); font-family: courier new,monospace;">&lt;/table&gt;</span><br>
<br>This is the error which i got.<br>&nbsp;&nbsp;&nbsp; <br><span style="color: rgb(255, 102, 102); font-family: courier new,monospace;">Site Error</span><br style="color: rgb(255, 102, 102); font-family: courier new,monospace;"><br style="color: rgb(255, 102, 102); font-family: courier new,monospace;">
<span style="color: rgb(255, 102, 102); font-family: courier new,monospace;">An error was encountered while publishing this resource.</span><br style="color: rgb(255, 102, 102); font-family: courier new,monospace;"><span style="color: rgb(255, 102, 102); font-family: courier new,monospace;">exceptions.KeyError</span><br style="color: rgb(255, 102, 102); font-family: courier new,monospace;">
<span style="color: rgb(255, 102, 102); font-family: courier new,monospace;">Sorry, a site error occurred.</span><br style="color: rgb(255, 102, 102); font-family: courier new,monospace;"><span style="color: rgb(255, 102, 102); font-family: courier new,monospace;">Traceback (innermost last):</span><br style="color: rgb(255, 102, 102); font-family: courier new,monospace;">
<span style="color: rgb(255, 102, 102); font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; * Module ZPublisher.Publish, line 150, in publish_module</span><br style="color: rgb(255, 102, 102); font-family: courier new,monospace;"><span style="color: rgb(255, 102, 102); font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; * Module ZPublisher.Publish, line 114, in publish</span><br style="color: rgb(255, 102, 102); font-family: courier new,monospace;">
<span style="color: rgb(255, 102, 102); font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; * Module Zope, line 134, in zpublisher_exception_hook</span><br style="color: rgb(255, 102, 102); font-family: courier new,monospace;"><span style="color: rgb(255, 102, 102); font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; * Module Shared.DC.ZRDB.DA, line 547, in __getattr__</span><br style="color: rgb(255, 102, 102); font-family: courier new,monospace;">
<span style="color: rgb(255, 102, 102); font-family: courier new,monospace;">KeyError: _r</span><br style="color: rgb(255, 102, 102); font-family: courier new,monospace;"><span style="color: rgb(255, 102, 102); font-family: courier new,monospace;">Troubleshooting Suggestions</span><br style="color: rgb(255, 102, 102); font-family: courier new,monospace;">
<span style="color: rgb(255, 102, 102); font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; * The URL may be incorrect.</span><br style="color: rgb(255, 102, 102); font-family: courier new,monospace;"><span style="color: rgb(255, 102, 102); font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; * The parameters passed to this resource may be incorrect.</span><br style="color: rgb(255, 102, 102); font-family: courier new,monospace;">
<span style="color: rgb(255, 102, 102); font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; * A resource that this resource relies on may be encountering an error.</span><br style="color: rgb(255, 102, 102); font-family: courier new,monospace;">
<span style="color: rgb(255, 102, 102); font-family: courier new,monospace;">For more detailed information about the error, please refer to the HTML source for this page.</span><br style="color: rgb(255, 102, 102); font-family: courier new,monospace;">
<span style="color: rgb(255, 102, 102); font-family: courier new,monospace;">If the error persists please contact the site maintainer. Thank you for your patience. </span><br><br>Any kind of suggestion and help will be very useful. Thanks in advance.<br clear="all">
<br>-- <br>Best Regards<br>\madhan<br><br>Things must be learned only to be unlearned again or, more likely, to be corrected.<br> -- Richard Feynman