<div> </div>
<div>Hi Nancy, David, Ivan, Robbie, Rob, Jason</div>
<div>Thanks for wonderful ideas in this regard.</div>
<div> </div>
<div>Probably three different kind of query, which will work in this case as discussed above.</div>
<div> </div>
<div>1. GROUP BY .. HAVING COUNT(*)</div>
<div>2. EXISTS</div>
<div>3. And the one suggested by Ivan.</div>
<div> </div>
<div>I adopted the below query, though not sure which one is faster in MySQL.</div>
<div> </div>
<div>SELECT EmployeeID FROM `table` <br>WHERE `skill` IN (&#39;PHP&#39;,&#39;Java&#39;)<br>GROUP BY EmployeeID<br>HAVING COUNT(*) = 2</div>
<div> </div>
<div>As Nancy suggested, parametrized it as required.<br></div>
<div>If the query would have been &quot;search the employees having mandatory skills PHP, Java and <strong>Optional</strong> skills Pearl, VoIP&quot;.<br>I want to put it in single SQL query. Please suggest me what should be query.</div>

<div> </div>
<div>And the result should be shown in such a way that, people having more number of optional skills should be shown at start.</div>
<div>How can we acheive it?</div>
<div> </div>
<div>Best Regards</div>
<div>Austin</div>
<div> </div>
<div class="gmail_quote">On Sun, Apr 17, 2011 at 5:57 AM, nan wich <span dir="ltr">&lt;<a href="mailto:nan_wich@bellsouth.net">nan_wich@bellsouth.net</a>&gt;</span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div>
<div style="FONT-FAMILY: arial, helvetica, sans-serif; COLOR: black; FONT-SIZE: 12pt">
<div></div>
<div>I apologize, Ivan, in a quick read, I apparently confused your method with an earlier method. Indeed the multiple-join-same-table method not only works, but is the one often found in core (e.g. Taxonomy.module). I have not benchmarked either one, but I am going to assume that some core developer has at some time and that whoever that was discovered that either it is faster or that it is the best cross-database implementation. I do, however, feel that the EXISTS method is a more elegant and straight-forward solution, at least in MySql.<br>
 </div>
<p><font color="#ff007f" size="4" face="bookman old style, new york, times, serif"><em><strong>Nancy</strong></em></font></p>
<p> </p>
<p><font face="arial, helvetica, sans-serif">Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.</font></p>
<div><br></div>
<div style="FONT-FAMILY: arial, helvetica, sans-serif; FONT-SIZE: 12pt"><br><font size="2" face="Tahoma">
<div style="FONT-FAMILY: Courier New, monaco, monospace, sans-serif; FONT-SIZE: 10pt">
<hr size="1">
</div>
<div style="FONT-FAMILY: Courier New, monaco, monospace, sans-serif; FONT-SIZE: 10pt"><b><span style="FONT-WEIGHT: bold">From:</span></b> Ivan Sergio Borgonovo</div>
<div style="FONT-FAMILY: Courier New, monaco, monospace, sans-serif; FONT-SIZE: 10pt"> </div>
<div style="FONT-FAMILY: Courier New, monaco, monospace, sans-serif; FONT-SIZE: 10pt"></div></font>&gt; Actually, Ivan&#39;s query won&#39;t work because each skill is on a<br><br>It happens it worked with real data on a real DB (no pun on<br>
MySQL)</div></div></div><br>--<br>[ Drupal support list | <a href="http://lists.drupal.org/" target="_blank">http://lists.drupal.org/</a> ]<br></blockquote></div><br>